The truth is that I never learned how to navigate effectively with Vim’s
built-in commands. I know how to use
:e and its companions, but beyond that I
never gave it any thought.
It turns out that Vim’s tab completion, coupled with the
works really well since it can complete everything from buffers, unopened files
I use this for listing and switching buffers:
§ key is on the same row as the numbers on my keyboard, which makes it
fitting. I also have this in my
This will jump to the last edited file. Typing
^ requires two keystrokes for
me, hence the remapping.
You can also search for a tag by pattern:
I find tags extra useful when I’m dealing with CSS. If I want to jump to a class
.block I can do
:tag .bl, press
<Tab> and then hit
I unfortunately find tab completion to be a bit slow with the above command, but since I don’t work with large codebases I don’t use it that much.
To make it work recursively you need to modify the
You also need to make sure to modify the
wildignore option too, unless you
want to include files that belong to your dependencies:
Which I then use like this:
One of the nicest features that comes with ack.vim and other grepping plugins is that the quickfix window opens automatically after searching. Luckily, it’s not hard to enable that either:
The above snippet comes from vim-fugitive’s FAQ.
When I removed CtrlP I actually swapped it for another plugin, DidYouMean. I think the author describes its use case best:
If you’re like me and you want to edit a specific file with Vim, say,
test.py, you type
vim teinto the terminal, then you hit
<Enter>immediately because you think your shell expands the characters to the right file name. But if there’s another file starting with
te, Vim fires up with an empty file called
te, laughing at you. That’s annoying. This simple plugin makes Vim ask for the right file to open.
The plugin is only a handful of lines long, but it saves me from so much frustration.