Loading ...
Sorry, an error occurred while loading the content.
 

File Finder

Expand Messages
  • 703designs
    TextMate, Eclipse, and many other editors have one very nice feature: The ability to find any file in a project using just the file name (directories are
    Message 1 of 15 , Sep 30, 2008
      TextMate, Eclipse, and many other editors have one very nice feature:
      The ability to find any file in a project using just the file name
      (directories are reported in the dialog, but are insignificant).
      TextMate goes a step further, and allows you to almost search for a
      filename because it uses a sort of globbing.

      How could I implement this in Vim for all files in the current
      directory and its descendants? Has anyone done something like this
      already? Calling a tool like "find -f" may or may not work. One key
      feature of this dialog is that the file search updates live. The basic
      search pattern would be *query*, matching the search term at any point
      in the filename.
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • 703designs
      Thanks, this is a start. What are you doing with the let filelist part of the first line? Because if I just enter the command :glob( **/ *css* ), Vim returns
      Message 2 of 15 , Sep 30, 2008
        Thanks, this is a start. What are you doing with the "let filelist"
        part of the first line? Because if I just enter the command :glob('**/
        *css*'), Vim returns the error "Nested *, invalid command." I do get
        the feeling that you're wasting your time helping me, because I can't
        VimScript worth a damn.

        On Sep 30, 9:28 am, "A. S. Budden" <abud...@...> wrote:
        > 2008/9/30 703designs <thomasmal...@...>:
        >
        >
        >
        > > TextMate, Eclipse, and many other editors have one very nice feature:
        > > The ability to find any file in a project using just the file name
        > > (directories are reported in the dialog, but are insignificant).
        > > TextMate goes a step further, and allows you to almost search for a
        > > filename because it uses a sort of globbing.
        >
        > > How could I implement this in Vim for all files in the current
        > > directory and its descendants? Has anyone done something like this
        > > already? Calling a tool like "find -f" may or may not work. One key
        > > feature of this dialog is that the file search updates live. The basic
        > > search pattern would be *query*, matching the search term at any point
        > > in the filename.
        >
        > I'm not sure how you'd implement the dialog, but the search can be
        > done with something like:
        >
        > let filelist = glob('**/*query*')
        >
        > :help glob()
        > :help starstar
        >
        > Al
        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Thomas Geulig
        Maybe the lookupfile-plugin is what you want ... http://www.vim.org/scripts/script.php?script_id=1581 Thomas ...
        Message 3 of 15 , Sep 30, 2008
          Maybe the lookupfile-plugin is what you want ...

          http://www.vim.org/scripts/script.php?script_id=1581

          Thomas

          > Thanks, this is a start. What are you doing with the "let filelist"
          > part of the first line? Because if I just enter the command :glob('**/
          > *css*'), Vim returns the error "Nested *, invalid command." I do get
          > the feeling that you're wasting your time helping me, because I can't
          > VimScript worth a damn.
          >
          > On Sep 30, 9:28 am, "A. S. Budden" <abud...@...> wrote:
          > > 2008/9/30 703designs <thomasmal...@...>:
          > > > TextMate, Eclipse, and many other editors have one very nice feature:
          > > > The ability to find any file in a project using just the file name
          > > > (directories are reported in the dialog, but are insignificant).
          > > > TextMate goes a step further, and allows you to almost search for a
          > > > filename because it uses a sort of globbing.
          > > >
          > > > How could I implement this in Vim for all files in the current
          > > > directory and its descendants? Has anyone done something like this
          > > > already? Calling a tool like "find -f" may or may not work. One key
          > > > feature of this dialog is that the file search updates live. The basic
          > > > search pattern would be *query*, matching the search term at any point
          > > > in the filename.
          > >
          > > I'm not sure how you'd implement the dialog, but the search can be
          > > done with something like:
          > >
          > > let filelist = glob('**/*query*')
          > >
          > > :help glob()
          > > :help starstar
          > >
          > > Al



          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Charles Campbell
          ... That ll do current directory and subdirectories, and ... will search just the current directory. I suggest using v133 of netrw. Regards, Chip Campbell
          Message 4 of 15 , Sep 30, 2008
            703designs wrote:
            > TextMate, Eclipse, and many other editors have one very nice feature:
            > The ability to find any file in a project using just the file name
            > (directories are reported in the dialog, but are insignificant).
            > TextMate goes a step further, and allows you to almost search for a
            > filename because it uses a sort of globbing.
            >
            > How could I implement this in Vim for all files in the current
            > directory and its descendants? Has anyone done something like this
            > already? Calling a tool like "find -f" may or may not work. One key
            > feature of this dialog is that the file search updates live. The basic
            > search pattern would be *query*, matching the search term at any point
            > in the filename.
            >
            One option is to use netrw:

            :Explore **/filename

            That'll do current directory and subdirectories, and

            :Explore */filename

            will search just the current directory. I suggest using v133 of netrw.

            Regards,
            Chip Campbell


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Luc Hermitte
            Hello, ... I ve listed on searchInRuntime site [1] all other plugins that offer a similar feature. HTH, [1]
            Message 5 of 15 , Sep 30, 2008
              Hello,

              "703designs" <thomasmallen@...> wrote:

              > TextMate, Eclipse, and many other editors have one very nice feature:
              > The ability to find any file in a project using just the file name
              > (directories are reported in the dialog, but are insignificant).
              > TextMate goes a step further, and allows you to almost search for a
              > filename because it uses a sort of globbing.
              >
              > How could I implement this in Vim for all files in the current
              > directory and its descendants? Has anyone done something like this
              > already?

              I've listed on searchInRuntime site [1] all other plugins that offer a similar feature.

              HTH,

              [1] http://code.google.com/p/lh-vim/wiki/searchInRuntime

              --
              Luc Hermitte
              http://lh-vim.googlecode.com/
              http://hermitte.free.fr/vim/

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Luc Hermitte
              ... s/all// -- Luc Hermitte http://lh-vim.googlecode.com/ http://hermitte.free.fr/vim/ --~--~---------~--~----~------------~-------~--~----~ You received this
              Message 6 of 15 , Sep 30, 2008
                "Luc Hermitte" <hermitte@...> wrote:

                > "703designs" <thomasmallen@...> wrote:
                >
                > > TextMate, Eclipse, and many other editors have one very nice
                > > feature:
                > > The ability to find any file in a project using just the file name
                > > [...]

                > I've listed on searchInRuntime site [1] all other plugins that offer a
                > similar feature.

                s/all//

                --
                Luc Hermitte
                http://lh-vim.googlecode.com/
                http://hermitte.free.fr/vim/

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • A. S. Budden
                ... The let filelist part assigns the list of files to a variable called filelist . If you just want to print the names, you can do ... significant
                Message 7 of 15 , Sep 30, 2008
                  2008/9/30 703designs <thomasmallen@...>:
                  >
                  > Thanks, this is a start. What are you doing with the "let filelist"
                  > part of the first line? Because if I just enter the command :glob('**/
                  > *css*'), Vim returns the error "Nested *, invalid command." I do get
                  > the feeling that you're wasting your time helping me, because I can't
                  > VimScript worth a damn.

                  The let filelist part assigns the list of files to a variable called
                  "filelist". If you just want to print the names, you can do

                  :echo glob('**/*css*')

                  or:

                  :let filelist = glob('**/*css*')
                  :echo filelist

                  :glob is probably running :global rather than glob() - there is a
                  significant difference between functions (e.g. :global) and commands
                  (e.g. glob()). I'm sure there's a useful help reference for this, but
                  I couldn't find it in a quick search...

                  My guess is that :glob('**/*css*') is trying to run an empty command
                  on all lines that match the regular expression '**/*css*', i.e, all
                  lines that have 0 or more single quotes (except with two stars,
                  causing an error), followed by 0 or more forward slashes, the
                  characters 'cs', zero or more 's' characters and then a single
                  quote.... not quite what you had in mind!

                  Al

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • 703designs
                  Ah, went back and read the second reply about glob(), and this command is definitely what I need. I think I can write a good plugin that makes selecting glob()
                  Message 8 of 15 , Sep 30, 2008
                    Ah, went back and read the second reply about glob(), and this command
                    is definitely what I need. I think I can write a good plugin that
                    makes selecting glob() filenames easy. I guess I'll start by breaking
                    down the returned string and passing in the firt file path to :e.

                    On Sep 30, 10:15 am, 703designs <thomasmal...@...> wrote:
                    > Oh, here's one simple answer. I can just use :find **/
                    > whateverpathpattern. I'll write a simple wrapper for the find command
                    > that always returns **/*query* and map it.
                    >
                    > I'm not sure how this relates to the earlier glob() example, but
                    > thanks!
                    >
                    > Thomas
                    >
                    > On Sep 30, 10:09 am, "A. S. Budden" <abud...@...> wrote:
                    >
                    > > 2008/9/30 703designs <thomasmal...@...>:
                    >
                    > > > Thanks, this is a start. What are you doing with the "let filelist"
                    > > > part of the first line? Because if I just enter the command :glob('**/
                    > > > *css*'), Vim returns the error "Nested *, invalid command." I do get
                    > > > the feeling that you're wasting your time helping me, because I can't
                    > > > VimScript worth a damn.
                    >
                    > > The let filelist part assigns the list of files to a variable called
                    > > "filelist".  If you just want to print the names, you can do
                    >
                    > > :echo glob('**/*css*')
                    >
                    > > or:
                    >
                    > > :let filelist = glob('**/*css*')
                    > > :echo filelist
                    >
                    > > :glob is probably running :global rather than glob() - there is a
                    > > significant difference between functions (e.g. :global) and commands
                    > > (e.g. glob()).  I'm sure there's a useful help reference for this, but
                    > > I couldn't find it in a quick search...
                    >
                    > > My guess is that :glob('**/*css*') is trying to run an empty command
                    > > on all lines that match the regular expression '**/*css*', i.e, all
                    > > lines that have 0 or more single quotes (except with two stars,
                    > > causing an error), followed by 0 or more forward slashes, the
                    > > characters 'cs', zero or more 's' characters and then a single
                    > > quote.... not quite what you had in mind!
                    >
                    > > Al
                    >
                    >
                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • 703designs
                    As far LookupFile, it has a function similar to what I m planning (LUWalk) but it has a stupid genutils dependency and a ton of functionality I don t need,
                    Message 9 of 15 , Sep 30, 2008
                      As far LookupFile, it has a function similar to what I'm planning
                      (LUWalk) but it has a stupid "genutils" dependency and a ton of
                      functionality I don't need, so I don't think I'm really repeating
                      someone else's work.

                      On Sep 30, 10:20 am, 703designs <thomasmal...@...> wrote:
                      > Ah, went back and read the second reply about glob(), and this command
                      > is definitely what I need. I think I can write a good plugin that
                      > makes selecting glob() filenames easy. I guess I'll start by breaking
                      > down the returned string and passing in the firt file path to :e.
                      >
                      > On Sep 30, 10:15 am, 703designs <thomasmal...@...> wrote:
                      >
                      > > Oh, here's one simple answer. I can just use :find **/
                      > > whateverpathpattern. I'll write a simple wrapper for the find command
                      > > that always returns **/*query* and map it.
                      >
                      > > I'm not sure how this relates to the earlier glob() example, but
                      > > thanks!
                      >
                      > > Thomas
                      >
                      > > On Sep 30, 10:09 am, "A. S. Budden" <abud...@...> wrote:
                      >
                      > > > 2008/9/30 703designs <thomasmal...@...>:
                      >
                      > > > > Thanks, this is a start. What are you doing with the "let filelist"
                      > > > > part of the first line? Because if I just enter the command :glob('**/
                      > > > > *css*'), Vim returns the error "Nested *, invalid command." I do get
                      > > > > the feeling that you're wasting your time helping me, because I can't
                      > > > > VimScript worth a damn.
                      >
                      > > > The let filelist part assigns the list of files to a variable called
                      > > > "filelist".  If you just want to print the names, you can do
                      >
                      > > > :echo glob('**/*css*')
                      >
                      > > > or:
                      >
                      > > > :let filelist = glob('**/*css*')
                      > > > :echo filelist
                      >
                      > > > :glob is probably running :global rather than glob() - there is a
                      > > > significant difference between functions (e.g. :global) and commands
                      > > > (e.g. glob()).  I'm sure there's a useful help reference for this, but
                      > > > I couldn't find it in a quick search...
                      >
                      > > > My guess is that :glob('**/*css*') is trying to run an empty command
                      > > > on all lines that match the regular expression '**/*css*', i.e, all
                      > > > lines that have 0 or more single quotes (except with two stars,
                      > > > causing an error), followed by 0 or more forward slashes, the
                      > > > characters 'cs', zero or more 's' characters and then a single
                      > > > quote.... not quite what you had in mind!
                      >
                      > > > Al
                      >
                      >
                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Nate-37
                      ... I recently stumbled upon two viable candidates. 1) FuzzyFileFinder 2) TSelectFile I m leaning towards TSelectFile, but I have e-mailed FuzzyFileFinder s
                      Message 10 of 15 , Oct 1 1:37 AM
                        >As far LookupFile, it has a function similar to what I'm planning
                        >(LUWalk) but it has a stupid "genutils" dependency and a ton of
                        >functionality I don't need, so I don't think I'm really repeating

                        I recently stumbled upon two viable candidates.
                        1) FuzzyFileFinder
                        2) TSelectFile

                        I'm leaning towards TSelectFile, but I have e-mailed FuzzyFileFinder's
                        author, and
                        he's responded very quickly, and so FuzzyFileFinder appears to be very well
                        supported.

                        I share your enthusiasm for Textmate's way of doing it, which is simple.

                        The common problem with both of these plugins (Fuzzy and TSelect) is that if
                        you open
                        Vim in a giant folder and use the TSelectInSubdirs or FuzzyFinderFile
                        command, you will be
                        globbing all those files.

                        I need to request that the authors create some kind of g:maxFiles variable.
                        However, in looking
                        at the plugins' code, it appears that they both use the Vim scripting
                        language's "glob" function, which doesn't appear to support some kind of
                        max.

                        Please share your solution if you find one.

                        Thanks,
                        --Nate

                        someone else's work.

                        tmallen wrote:
                        >
                        >
                        > As far LookupFile, it has a function similar to what I'm planning
                        > (LUWalk) but it has a stupid "genutils" dependency and a ton of
                        > functionality I don't need, so I don't think I'm really repeating
                        > someone else's work.
                        >
                        > On Sep 30, 10:20 am, 703designs <thomasmal...@...> wrote:
                        >> Ah, went back and read the second reply about glob(), and this command
                        >> is definitely what I need. I think I can write a good plugin that
                        >> makes selecting glob() filenames easy. I guess I'll start by breaking
                        >> down the returned string and passing in the firt file path to :e.
                        >>
                        >> On Sep 30, 10:15 am, 703designs <thomasmal...@...> wrote:
                        >>
                        >> > Oh, here's one simple answer. I can just use :find **/
                        >> > whateverpathpattern. I'll write a simple wrapper for the find command
                        >> > that always returns **/*query* and map it.
                        >>
                        >> > I'm not sure how this relates to the earlier glob() example, but
                        >> > thanks!
                        >>
                        >> > Thomas
                        >>
                        >> > On Sep 30, 10:09 am, "A. S. Budden" <abud...@...> wrote:
                        >>
                        >> > > 2008/9/30 703designs <thomasmal...@...>:
                        >>
                        >> > > > Thanks, this is a start. What are you doing with the "let filelist"
                        >> > > > part of the first line? Because if I just enter the command
                        >> :glob('**/
                        >> > > > *css*'), Vim returns the error "Nested *, invalid command." I do
                        >> get
                        >> > > > the feeling that you're wasting your time helping me, because I
                        >> can't
                        >> > > > VimScript worth a damn.
                        >>
                        >> > > The let filelist part assigns the list of files to a variable called
                        >> > > "filelist".  If you just want to print the names, you can do
                        >>
                        >> > > :echo glob('**/*css*')
                        >>
                        >> > > or:
                        >>
                        >> > > :let filelist = glob('**/*css*')
                        >> > > :echo filelist
                        >>
                        >> > > :glob is probably running :global rather than glob() - there is a
                        >> > > significant difference between functions (e.g. :global) and commands
                        >> > > (e.g. glob()).  I'm sure there's a useful help reference for this,
                        >> but
                        >> > > I couldn't find it in a quick search...
                        >>
                        >> > > My guess is that :glob('**/*css*') is trying to run an empty command
                        >> > > on all lines that match the regular expression '**/*css*', i.e, all
                        >> > > lines that have 0 or more single quotes (except with two stars,
                        >> > > causing an error), followed by 0 or more forward slashes, the
                        >> > > characters 'cs', zero or more 's' characters and then a single
                        >> > > quote.... not quite what you had in mind!
                        >>
                        >> > > Al
                        >>
                        >>
                        > >
                        >
                        >

                        --
                        View this message in context: http://www.nabble.com/File-Finder-tp19741842p19756556.html
                        Sent from the Vim - General mailing list archive at Nabble.com.


                        --~--~---------~--~----~------------~-------~--~----~
                        You received this message from the "vim_use" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                        -~----------~----~----~----~------~----~------~--~---
                      • toomln
                        ... In the next version of tselectfiles, there will be a tselectfiles_limit variable (the max depth). tselectfiles does this globbing only once. In subsequent
                        Message 11 of 15 , Oct 1 2:36 AM
                          > I need to request that the authors create some kind of g:maxFiles variable.

                          In the next version of tselectfiles, there will be a
                          tselectfiles_limit variable (the max depth).

                          tselectfiles does this globbing only once. In subsequent uses, the
                          cached value is used (unless the command is called with "!"), which
                          should be faster.

                          In general, I'd suggest to use some kind of manifest/file listing for
                          bigger projects. trag[1] can be used to handle that.


                          [1] http://www.vim.org/scripts/script.php?script_id=2033

                          --~--~---------~--~----~------------~-------~--~----~
                          You received this message from the "vim_use" maillist.
                          For more information, visit http://www.vim.org/maillist.php
                          -~----------~----~----~----~------~----~------~--~---
                        • Nate-37
                          ... Very cool! I will check it out as soon as you release it. Thanks, --Nate ... -- View this message in context:
                          Message 12 of 15 , Oct 1 9:26 AM
                            >In the next version of tselectfiles, there will be
                            > a tselectfiles_limit variable (the max depth).

                            Very cool!

                            I will check it out as soon as you release it.

                            Thanks,
                            --Nate

                            toomln wrote:
                            >
                            >
                            >> I need to request that the authors create some kind of g:maxFiles
                            >> variable.
                            >
                            > In the next version of tselectfiles, there will be a
                            > tselectfiles_limit variable (the max depth).
                            >
                            > tselectfiles does this globbing only once. In subsequent uses, the
                            > cached value is used (unless the command is called with "!"), which
                            > should be faster.
                            >
                            > In general, I'd suggest to use some kind of manifest/file listing for
                            > bigger projects. trag[1] can be used to handle that.
                            >
                            >
                            > [1] http://www.vim.org/scripts/script.php?script_id=2033
                            >
                            > >
                            >
                            >

                            --
                            View this message in context: http://www.nabble.com/File-Finder-tp19741842p19764211.html
                            Sent from the Vim - General mailing list archive at Nabble.com.


                            --~--~---------~--~----~------------~-------~--~----~
                            You received this message from the "vim_use" maillist.
                            For more information, visit http://www.vim.org/maillist.php
                            -~----------~----~----~----~------~----~------~--~---
                          Your message has been successfully submitted and would be delivered to recipients shortly.