sponsor Vim development Vim logo Vim Book Ad

textobj-comment : Text objects for comments

 script karma  Rating 0/0, Downloaded by 147    Comments, bugs, improvements  Vim wiki

created by
glts
 
script type
utility
 
description
The textobj-comment plugin provides text objects to select comments.

"ac" selects a comment including the comment delimiters, "ic" selects the comment content without the delimiters.  A third text object, "aC", selects a "big" comment, including trailing or leading whitespace.

textobj-comment uses the filetype-specific 'comments' setting to determine what a comment looks like for a given language.  Make sure you have enabled filetype plugins in your configuration to make this work.

In order to find a target, textobj-comment looks for a comment under the cursor, in or at the end of the cursor line, and above the cursor line.  You can see a demo of the text objects and the heuristic in the documentation.

This plugin depends on the textobj-user plugin, version 0.4.0 (vimscript #2100).
https://github.com/kana/vim-textobj-user
 
install details
Unzip the archive in your ~/.vim directory.  (On Windows, replace "~/.vim" with "$HOME\vimfiles" everywhere.)

This plugin is also hosted on Github at https://github.com/glts/vim-textobj-comment
With the Pathogen plugin manager the installation is as simple as:

cd ~/.vim/bundle
git clone git://github.com/glts/vim-textobj-comment.git textobj-comment

But this plugin also plays well with the built-in GetLatestVimScripts and other plugin managers such as Vundle, vim-addon-manager, and vim-flavor.

Don't forget to install textobj-user first if your setup doesn't take care of dependencies automatically.
 

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
textobj-comment.zip 1.0.0 2013-05-04 7.3 glts Initial upload
ip used for rating: 54.196.189.229

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.
   
SourceForge.net Logo