nerdcommenter/README.md

81 lines
2.4 KiB
Markdown
Raw Normal View History

2012-03-26 23:32:56 +08:00
# Installation
The NERD Commenter requires Vim 7 or higher.
2012-03-26 23:12:53 +08:00
2012-03-26 23:32:56 +08:00
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
should have 2 files:
2012-03-26 23:36:43 +08:00
1. plugin/NERD_commenter.vim
2. doc/NERD_commenter.txt
2012-03-26 23:12:53 +08:00
2012-03-26 23:32:56 +08:00
Next, to finish installing the help file run:
2012-03-26 23:36:43 +08:00
* :helptags ~/.vim/doc
2012-03-26 23:32:56 +08:00
2012-03-26 23:36:43 +08:00
See **|add-local-help|** for more details.
2012-03-26 23:32:56 +08:00
Make sure that you have filetype plugins enabled, as the script makes use of
2012-03-26 23:36:43 +08:00
**|'commentstring'|** where possible (which is usually set in a filetype plugin).
See **|filetype-plugin-on|** for details, but basically, stick this in your vimrc:
> filetype plugin on
2012-03-26 23:32:56 +08:00
# Usage
2012-03-26 23:12:53 +08:00
The following key mappings are provided by default (there is also a menu
provided that contains menu items corresponding to all the below mappings):
2012-03-26 23:32:56 +08:00
Most of the following mappings are for normal/visual mode only. The |NERDComInsertComment| mapping is for insert mode only.
2012-03-26 23:12:53 +08:00
2012-03-26 23:32:56 +08:00
**[count]\<leader\>cc |NERDComComment|**
2012-03-26 23:12:53 +08:00
Comment out the current line or text selected in visual mode.
2012-03-26 23:36:43 +08:00
**[count]\<leader\>cn |NERDComNestedComment|**
Same as \<leader\>cc but forces nesting.
2012-03-26 23:12:53 +08:00
2012-03-26 23:36:43 +08:00
**[count]\<leader\>c<space> |NERDComToggleComment|**
2012-03-26 23:12:53 +08:00
Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.
2012-03-26 23:36:43 +08:00
**[count]\<leader\>cm |NERDComMinimalComment|**
2012-03-26 23:12:53 +08:00
Comments the given lines using only one set of multipart delimiters.
2012-03-26 23:36:43 +08:00
**[count]\<leader\>ci |NERDComInvertComment|**
2012-03-26 23:12:53 +08:00
Toggles the comment state of the selected line(s) individually.
2012-03-26 23:36:43 +08:00
**[count]\<leader\>cs |NERDComSexyComment|**
2012-03-26 23:12:53 +08:00
Comments out the selected lines ``sexily''
2012-03-26 23:36:43 +08:00
**[count]\<leader\>cy |NERDComYankComment|**
Same as \<leader\>cc except that the commented line(s) are yanked first.
2012-03-26 23:12:53 +08:00
2012-03-26 23:36:43 +08:00
**\<leader\>c$ |NERDComEOLComment|**
2012-03-26 23:12:53 +08:00
Comments the current line from the cursor to the end of line.
2012-03-26 23:36:43 +08:00
**\<leader\>cA |NERDComAppendComment|**
2012-03-26 23:12:53 +08:00
Adds comment delimiters to the end of line and goes into insert mode between
them.
2012-03-26 23:32:56 +08:00
**|NERDComInsertComment|**
2012-03-26 23:12:53 +08:00
Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.
2012-03-26 23:36:43 +08:00
**\<leader\>ca |NERDComAltDelim|**
2012-03-26 23:12:53 +08:00
Switches to the alternative set of delimiters.
2012-03-26 23:36:43 +08:00
**[count]\<leader\>cl**
**[count]\<leader\>cb |NERDComAlignedComment|**
2012-03-26 23:12:53 +08:00
Same as |NERDComComment| except that the delimiters are aligned down the
2012-03-26 23:36:43 +08:00
left side (\<leader\>cl) or both sides (\<leader\>cb).
2012-03-26 23:12:53 +08:00
2012-03-26 23:36:43 +08:00
**[count]\<leader\>cu |NERDComUncommentLine|**
2012-03-26 23:12:53 +08:00
Uncomments the selected line(s).