vim 代码注释插件
參考:
1、http://www.vim.org/scripts/script.php?script_id=1218
2、http://www.dutor.net/index.php/2010/05/vim-the-nerd-commenter/
?
參考1:
The following key mappings are provided by default (there is also a menu
provided that contains menu items corresponding to all the below mappings):
Most of the following mappings are for normal/visual mode only. The
|NERDComInsertComment| mapping is for insert mode only.
[count]<leader>cc |NERDComComment|
Comment out the current line or text selected in visual mode.
[count]<leader>cn |NERDComNestedComment|
Same as <leader>cc but forces nesting.
[count]<leader>c<space> |NERDComToggleComment|
Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.
[count]<leader>cm |NERDComMinimalComment|
Comments the given lines using only one set of multipart delimiters.
[count]<leader>ci |NERDComInvertComment|
Toggles the comment state of the selected line(s) individually.
[count]<leader>cs |NERDComSexyComment|
Comments out the selected lines ``sexily''
[count]<leader>cy |NERDComYankComment|
Same as <leader>cc except that the commented line(s) are yanked first.
<leader>c$ |NERDComEOLComment|
Comments the current line from the cursor to the end of line.
<leader>cA |NERDComAppendComment|
Adds comment delimiters to the end of line and goes into insert mode between
them.
|NERDComInsertComment|
Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.
<leader>ca |NERDComAltDelim|
Switches to the alternative set of delimiters.
[count]<leader>cl
[count]<leader>cb??? |NERDComAlignedComment|
Same as |NERDComComment| except that the delimiters are aligned down the
left side (<leader>cl) or both sides (<leader>cb).
[count]<leader>cu |NERDComUncommentLine|
Uncomments the selected line(s).
?
install details
The NERD Commenter requires Vim 7 or higher.
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
should have 2 files:
??? plugin/NERD_commenter.vim
??? doc/NERD_commenter.txt
Next, to finish installing the help file run:
??? :helptags ~/.vim/doc
See |add-local-help| for more details.
Make sure that you have filetype plugins enabled, as the script makes use of
|'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
?
參考2:
這是一款供Vim使用的插件,看名字可以知道,它和The NERD Tree同屬一個(gè)作者。使用這款插件,你可以對(duì)多種文件類型的文件進(jìn)行不同方式地、快速地注釋。這對(duì)使用Vim來寫代碼或者修改配置文件的同學(xué)來說,無疑是提升效率和快感的一件利器。你可以到這里來下載這個(gè)插件,將壓縮包里面的doc/和plugin/文件夾丟到~/.vim/下面就是安裝了。為了可以使用其幫助文檔,你還需要在Vim中執(zhí)行:helptags ~/.vim/doc/來注冊。
簡單介紹下NERD Commenter的常用鍵綁定,以C/C++文件為例,詳析的使用方法,請(qǐng):h NERDCommenter。在Normal或者Visual 模式下:
??? ,ca,在可選的注釋方式之間切換,比如C/C++ 的塊注釋/* */和行注釋//
??? ,cc,注釋當(dāng)前行
??? ,c,切換注釋/非注釋狀態(tài)
??? ,cs,以”性感”的方式注釋
??? ,cA,在當(dāng)前行尾添加注釋符,并進(jìn)入Insert模式
??? ,cu,取消注釋
??? Normal模式下,幾乎所有命令前面都可以指定行數(shù)
??? Visual模式下執(zhí)行命令,會(huì)對(duì)選中的特定區(qū)塊進(jìn)行注釋/反注釋
注:各命令前綴是可以自己設(shè)置的,通常是逗號(hào)’,'或者’\’.
?
轉(zhuǎn)載于:https://www.cnblogs.com/pengdonglin137/p/3356952.html
總結(jié)
以上是生活随笔為你收集整理的vim 代码注释插件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据库:内联接,外联接,空值和联接
- 下一篇: 一个支持Abort的Background