sponsor Vim development Vim logo Vim Book Ad

vim_comment_toggle : Simple and lightweight comment toggle scripts

 script karma  Rating 1/1, Downloaded by 1044  Comments, bugs, improvements  Vim wiki

created by
A. G. Madi
 
script type
ftplugin
 
description
A very simple and lightweight way to toggle comments on one or more lines.  It works in normal mode and visual mode.

By default, the toggle is mapped to <CTRL+_> but can be easily changed.

Files included for: C, C++, Python, Erlang, shell scripts.

Currently, only one comment type is supported at a time. If a different file type is loaded in the same Vim session, then a warning is given and the keys are not remapped. I'll be looking into making it smarter in the future as long as it stays simple.

https://github.com/WarpEngineer/vim_comment_toggle
 
install details
Just copy the scripts to ~/.vim/ftplugin or just add the 'ToggleComment()' function and key maps in the files to files that are already in the 'ftplugin' directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim_comment_toggle.zip 1.1.2 2016-11-10 7.0 A. G. Madi Added a check to keep different file types from remapping the keys.
vim_comment_toggle.zip 1.1.1 2016-10-17 7.0 A. G. Madi Added a file for shell scripts.
vim_comment_toggle.zip 1.1 2016-10-09 7.0 A. G. Madi Made uncommenting smarter in that the comment character does not have to
be in the first postion.
ip used for rating: 34.229.223.223

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github