How to switch between files in Vim?
dougkearns at gmail.com
Sun Apr 30 10:37:32 EDT 2006
On Sun, Apr 30, 2006 at 07:27:16PM +1000, Gavin Sinclair wrote:
> Hi folks,
> Just wondering...
> If you have a lot of files open in Vim, how do you switch to the one
> you want in the easiest fashion?
I find that if there's a manageable amount, say less than 10, you can
generally remember the buffer number. If there's more than that then I
use the second method.
> In my Rails project, there are lots of files (models, views,
> between them. I use and highly recommend the Project plugin, but
> ideally I could just type in a few characters from the filename and go
> The perfect interface would be something like this. Say I want to
> switch to "user_controller.rb".
> - CTRL-G (for Goto file) pops up a small window where I can type
> letters and it can display some matching filenames
> - I type "user" and it narrows it down to about 6 files
A mapping is useful here. Something like:
:cmap <Tab> <C-l><C-d>
> - I hit space and type "cont", which is enough to score a unique match
> - I hit ENTER and that file opens
More information about the vim-ruby-devel