nerdcommenter/README.md

96 lines
3.0 KiB
Markdown
Raw Normal View History

2012-03-26 23:32:56 +08:00
# Installation
2012-03-26 23:12:53 +08:00
_\*For simplicity, let's use **[VIM_ROOT]** which will mean ~/.vim (\*nix) or ~/vimfiles (Windows)_
2012-03-27 00:15:42 +08:00
The NERD Commenter requires Vim 7 or higher is comprised of 2 files:
2012-03-26 23:42:40 +08:00
plugin/NERD_commenter.vim
doc/NERD_commenter.txt
2012-03-26 23:12:53 +08:00
### Classic Install
2012-06-19 16:42:10 +08:00
1. Extract the plugin files into your **[VIM_ROOT]**/plugin and **[VIM_ROOT]**/doc folders respectively.
2. Finish the install by updating your help files. Run:
2012-03-27 00:16:34 +08:00
<pre><code>:helptags [VIM_ROOT]/doc</code></pre>
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
### Pathogen Install
1. Navigate to your **[VIM_ROOT]/bundle** directory in your local Vim setup
2. `git clone https://github.com/scrooloose/nerdcommenter.git`
2015-02-15 23:44:28 +08:00
### Vundle Install
1. Add `Plugin 'scrooloose/nerdcommenter'` to your .vimrc file.
2. Run `:BundleInstall`
### Post Install
After the **'Classic'** or **'Pathogen'** install, 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:
2012-03-26 23:42:40 +08:00
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
**[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).