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

Re: "Go to file" quickly

Expand Messages
  • Felix Geisendörfer
    Nico + Niklas: Thank you so much for your excellent advice and tips! This is exactly what I ve been looking for ! ...
    Message 1 of 7 , Dec 22, 2008
      Nico + Niklas: Thank you so much for your excellent advice and tips!
      This is exactly what I've been looking for !

      On Dec 18, 8:37 pm, "Niklas Lindström" <lindstr...@...> wrote:
      > Hi!
      > Here are some of my (general Vim) tips regarding buffer/file
      > navigation/discovery.
      > I regularly populate the buffer list over time (see also :ls, :bd),
      > and :mksession to save my working sessions (often a huge pile of
      > splits and tabs). To jump to buffers, I then use the very powerful :sb
      > command, which intelligently matches anywhere within the file path. So
      > e.g.:
      >     :sb some<Tab>
      > gives completions like:
      >     path/to/some/file.txt
      >     wholesome/tips.txt
      >     other/some
      > For this, I have this in my .vimrc:
      >     set wildmenu
      >     set wildmode=list:longest,full
      >     set switchbuf=usetab,split
      > , which firstly sets up completion as *I* like it (YMMV). The
      > 'switchbuf' setting makes :sb jump to the file in an existing window
      > in any tab, and if none are open, use a split. (Compare to the default
      > :sb behaviour which always uses the current window.)
      > I also (judiciously) use recursive-globs (**); e.g.:
      >     :e path-part/**/some<Tab>
      > And, for e.g. refactoring, lots of:
      >     :vimgrep /some-regexp/j path-part/**/*.py
      >     :copen
      > (The 'j' is for *not* jumping to the first match automatically.)
      > Also, if you (for instance) want to do *massive* remakes of lots of
      > files within a directory, I recommend:
      >     :cd path/to/data
      >     :n **/*.data
      > , which loads all matched files as buffers, which you can navigate
      > with e.g. :sb; and furthermore can be modified with stuff like :bufdo
      > (the once instance where I ":set hidden" if I do multiple replacements
      > etc. and want to inspect them prior to writing).
      > [Finally, always use the vim help system if you wonder about a command
      > or option etc. E.g:
      >     :help :sb
      >     :help :vimgrep
      >     :help 'switchbuf'
      >     :help 'wildmode'
      >     :help 'hidden'
      >     :help :wa
      > and so on.]
      > Best of luck and best regards,
      > Niklas
      > On Thu, Dec 18, 2008 at 4:10 PM, Nico Weber <nicolaswe...@...> wrote:
      > >> In textmate there is the wonderful "Go to file" command which lets you
      > >> perform a fuzzy search on all files in the project which usually gets
      > >> you to open the file you want in < 1s. I don't necessarily need
      > >> something exactly like it, but I am very much interested in how
      > >> everybody in here deals with quickly opening files.
      > > Depends a bit on the project. For smaller projects, I usually open all
      > > files in buffers when I start MacVim (`mvim *.py`, for very small
      > > projects `mvim -p *.py`) and then use BufExplorer to move around (the
      > > plugin Markus linked to can also navigate buffers, but I haven't
      > > really tried it yet). For larger projects, I build a cscope database
      > > and use that to move around (`:h cscope`). The two plugins a.vim and
      > > NERDTree are useful too.
      > > Nico
      > > ps: The LustyExplorer plugin looks similar to Jamis' plugin and might
      > > be easier to install. Haven't tried this one either, though.
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.