Skip to content

To Comment/Un-Comment single/multiple lines of code for different source files

Notifications You must be signed in to change notification settings

sudar/comments.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

comments.vim

Global Plugin to comment and un-comment lines in different source files in both normal and visual mode

The following are the changes that I have done to the original Plugin

  • Added support for React (.jsx) and TypeScript (.ts)
  • Added support for Arduino files (both .pde and .ino)
  • Added support for Pig files (.pig)
  • Added support for Golang (.go) (by Athom)
  • Added support for remapping the keys if needed
  • Added support for Clojure and ClojureScript (by seedano)
  • Added support for Matlab and Octave (*.m) files

Credit goes to the original author Jasmeet Singh Anand.

Installation

Manual

Stick this file in your ~/.vim/plugin directory or in some other 'plugin' directory that is in your runtime path

Using Vundle

    Bundle "sudar/comments.vim"

    And :BundleInstall

Configuration

By default, the following keys are mapped

  • Ctrl-c - to comment a single line or visual block
  • Ctrl-x - to un-comment a single line or visual block

You can map your own keys if needed

    let g:comments_map_keys = 0

    " key-mappings for comment line in normal mode
    noremap  <silent> <C-L> :call CommentLine()<CR>
    " key-mappings for range comment lines in visual <Shift-V> mode
    vnoremap <silent> <C-L> :call RangeCommentLine()<CR>

    " key-mappings for un-comment line in normal mode
    noremap  <silent> <C-K> :call UnCommentLine()<CR>
    " key-mappings for range un-comment lines in visual <Shift-V> mode
    vnoremap <silent> <C-K> :call RangeUnCommentLine()<CR>

Original Readme file

This is a mirror of http:https://www.vim.org/scripts/script.php?script_id=1528

Global Plugin to comment and un-comment lines in different source files in both normal and visual mode usage: ctrl-c to comment a single line ctrl-x to un-comment a single line shift-v and select multiple lines, then ctrl-c to comment the selected multiple lines shift-v and select multiple lines, then ctrl-x to un-comment the selected multiple lines supports: c, c++, java, php[2345], proc, css, html, htm, xml, xhtml, vim, vimrc, sql, sh, ksh, csh, perl, tex, fortran, ml, caml, ocaml, vhdl, haskel and normal files

About

To Comment/Un-Comment single/multiple lines of code for different source files

Resources

Stars

Watchers

Forks

Packages

No packages published