tComment - Quickly Comment Out Text - Linux VIM

3,375 views · Published 13 July 2013 · 2:54 · Indexed 8 November 2026

Channel: gotbletu · 2013 · Science & Technology

Watch on YouTube

http://www.vim.org/scripts/script.php?script_id=1173
https://github.com/vim-scripts/tComment


some hotkeys:
gcc - single line
gcip - block of text
gc ( in visual mode)
Ctrl_Ctrl_ - single line
Ctrl_ + p - block of text

:TComment works like a toggle, i.e., it will comment out text that 
contains uncommented lines, and it will uncomment already 
commented text (i.e. text that contains no uncommented lines).

If the file-type is properly defined, :TComment will figure out which 
comment string to use based on the values of &commentstring or &comments. 
For some filetypes, the comment definition is explicitly defined. You can 
|tcomment#DefineType()| to add your own definitions.

TComment knows how to deal with embedded code of a different filetype 
than the main filetype, e.g., ruby/python/perl regions in vim scripts, HTML or 
JavaScript in php code etc.

More from this channel