UncommEnter lets you end a comment series caused by formatoption r
by
simply hitting Enter on the last empty line of a comment.
For more information on usage, options and license, see UncommEnter.txt
or type :help UncommEnter
inside Vim.
http://github.com/padde/UncommEnter.vim
Pathogen
cd ~/.vim/bundle
git clone git://github.com/padde/UncommEnter.vim.git
Vundle
add this line to your ~/.vimrc
:
Bundle 'padde/UncommEnter.vim'
In the following examples, |
represents the cursor.
# this is a comment|
hit Enter
# this is a comment
# |
hit Enter again
# this is a comment
|
This means you don't have to type Esc+⇧+S or Ctrl+U any more. UncommEnter is smart enough to not fiddle around with comments when you're in the middle of a multi-line comment like this one:
# this is a comment|
# that spans multiple lines
hit Enter
# this is a comment
# |
# that spans multiple lines
hit Enter again
# this is a comment
#
# |
# that spans multiple lines
The tradeoff is that if you actually want multiple empty comment lines, you have to re-add one line manually:
# this is a comment|
hit Enter
# this is a comment
# |
hit Esco
# this is a comment
#
# |
UncommEnter will however not delete the comment marker if the previous line is also just an empty comment. That means for successive empty comment lines, you can just hit Enter as normal:
# this is a comment
#
# |
hit Enter twice
# this is a comment
#
#
#
# |
UncommEnter currently uses &commentstring
to determine whether the
current line is an empty comment or not. This has only one form of the
comment marker for languages like C. Unfortunately, this seems to be
the multiline form (e.g. /* */
) most of the time. This means that
UncommEnter will not work properly in those languages. However, it does
not break existing behaviour, it will just not end the comment as
advertised.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request