NERD Commenter is a classic code comment plugin for Vim, which, by name, is the same author as the NERD tree. With this plugin, you can annotate files of multiple file types in different ways and quickly. This is a powerful tool for improving efficiency and pleasure for the students who use vim to write code or modify configuration files. You can go here to download this plugin, the compressed package inside the doc/and plugin/folder to ~/.vim/below is installed. In order to be able to use its help documentation, you also need to do this in vim: Helptags ~/.vim/doc/to register.
This paper introduces the common key bindings of nerd commenter, and uses the method of using C + + file as an example, please: H nerdcommenter. In normal or Visual mode:
- , CA, switch between optional annotation modes, such as block comments/*///and line comments//
- , CC, note when moving forward
- , c, toggle comment/non-comment status
- , CS, commenting in a "sexy" way
- , CA, add an annotation at the end of the current line, and enter insert mode
- , Cu, uncomment
- In normal mode, you can specify the number of lines in front of almost all commands
- Execute commands in visual mode to comment/counter-annotate specific chunks that are selected
Note: Each command prefix can be set by itself, usually a comma ', ' or ' \ '.
VIM Quick note