Created: 2012-03-23 00:48
Updated: 2014-06-11 00:11


vim-addon-commenting is a simple commenting plugin having enough feature for every day use


  • \ for commenting and uncommenting using selection or movement
  • pays attention col of cursor so that you can indent at col 0 or indentation level
  • n\\ comment n lines
  • prefer simple comemnts (// in C/C++ case) without configuration
  • tries to detect commenting based on 'commentstring' and 'comments' options simple comment till end of line comment markers

all options see plugin/commentary.vim and commentary#CommentLineRange(..)

If you need a sophisticated full blown commenting plugin try tcomment which magically even supports commenting JS within PHP code and such.

Installing repeat.vim will enable you to use . to repeat a commenting action


" Force commenting styles:
let g:vim_addon_commenting = {'force_filetype_comments': {'php': ['#',''], 'c' : ['/*','*/']}}

why fork?

based on

Because tpope told me: "cursor indentation level I think is a no, at this point". Whenever he changes his mind I'll be ready to merge.

related work

See .. There are many existing plugins. But I feel that they are hard to support because most of them have many hundreds of lines or are lacking features I want

Eg a very complete commenting implementation also supporting nested file types is tcomment


Distributable under the same terms as Vim itself. See :help license.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more