More Vim tips
| November 2nd, 2009I will continue my previous post with another few Vim tips I recently found in my quest to improve my Vim experience!
1) For those of you annoyed by the auto-comment feature of Vim (the feature that automatically inserts a comment leader in front of a line after your previous line was also commented), just enter this:
:set fo-=r
2) If you are like me and like to use Ctrl+E and Ctrl+A in your command line and want to also use this in Vim, here is a simple way to map end of line and beginning of line to Ctrl+E and Ctrl+A in Vim:
” map CTRL-E to end-of-line (insert mode)
imap
” map CTRL-A to beginning-of-line (insert mode)
imap
” map CTRL-E to end-of-line (normal mode)
nmap
” map CTRL-A to beginning-of-line (normal mode)
nmap
3) This is for the lazy ones or the ones that just can not get adjusted to Vim’s shortcuts, here is a trick to map Ctrl+C to copy to clipboard, Ctrl+V to paste and Ctrl+X to cut:
” map CTRL-C to copy (visual mode)
vmap
” map CTRL-X to cut (visual mode)
vmap
” map CTRL-V to paste (insert mode)
imap
Add them to your .vimrc and that’s it!