Here are some small Vim tweaks I discovered in the past few weeks that makes
working with Vim much more efficient. Many of these tips can already be found
elsewhere, but these are the ones I found most worthwhile.
Move vertically by visual line
This way, when a line is wrapped, you don't unexpectedly jump over it when navigating your file.
Highlight 81st column when needed
Credits go to Damien Conway (
http://radar.oreilly.com/2013/10/more-instantly-better-vim.html)
Open/create folds with the spacebar
This is a really handy setting. You can create folds using a visual selection and spacebar, and toggle them using the spacebar in normal mode.
Use Ag over grep or Ack
Because Ag is awesome and much faster. Let CtrlP use Ag without caching for up to date results, and define an
:Ag command that is mapped to backward slash.
Syntastic: show only icons in the gutter
I found it really annoying that everytime there was a small style error in a script, Syntastic opened the location list with the error. Here is how to hide the location list by default and have Syntastic show only an appropriate icon in the gutter.
Copy from Vim to clipboard
This lets you use
Ctrl+y to copy text from Vim to your clipboard.
Switch CapsLock and Escape
setxkbmap -option caps:swapescape
In Vim, you have to use the
Escape key a lot, but it is awkwardly positioned on the keyboard. With this command, you can change the functionality of the
CapsLock and
Escape keys. This is much better because
CapsLock is next to your home row. I tried two other mappings for a time:
jk and
kj (because
jk does occur quite often in Dutch words). However, I found that hitting
CapsLock is much faster.
And of course I use a couple of plugins. My full
vimrc file can be found
here. If you have any cool vim tips to share, please let me know in the comments.