As a novice vim user, I found that when I install a new plugin and installed the documentation into ~/.vim/doc folder, but when I try to read the documentation (e.g. “:help NERD_tree.txt” vim displays an error message “E149: Sorry, no help for
NERD_tree.txt”. This can be easily fixed by the following:
:helptags ~/.vim/doc
Recently, I have seriously started using Vim as my main text editor. It’s really cool stuff, because anything based on terminal is awesome
From today I’ll probably start to post a few hints that I found during the learning of using Vim. The purpose is to share some useful tips, and also keep my own references.
First tip I would like to share to day is to commenting a block of text using Vim.
- Highlight the block of text to be commented using the blockwise visual mode (ctrl-v), you don’t really have to highlight the entire code block, just the first character of the first line will do.
- Press the capital letter ‘I‘, and write whatever the comment symbol for the situation (e.g. ‘//’ for C, and ‘%’ for LaTex)
- Press the ESC key. The comment symbol will be automatically inserted at the front of each line
To uncomment, you can use the similar idea by first block visual select all comment symbol you are using, and then press ‘d‘ to delete the selected. There is no need to press ESC this time.