GitHub - tpope/vim-commentary: commentary.vim: comment stuff out
source link: https://github.com/tpope/vim-commentary
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
commentary.vim
Comment stuff out. Use gcc
to comment out a line (takes a count),
gc
to comment out the target of a motion (for example, gcap
to
comment out a paragraph), gc
in visual mode to comment out the selection,
and gc
in operator pending mode to target a comment. You can also use
it as a command, either with a range like :7,17Commentary
, or as part of a
:global
invocation like with :g/TODO/Commentary
. That's it.
I wrote this because 5 years after Vim added support for mapping an operator, I still couldn't find a commenting plugin that leveraged that feature (I overlooked tcomment.vim). Striving for minimalism, it weighs in at under 100 lines of code.
Oh, and it uncomments, too. The above maps actually toggle, and gcgc
uncomments a set of adjacent commented lines.
Installation
Install using your favorite package manager, or use Vim's built-in package support:
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/commentary.git
vim -u NONE -c "helptags commentary/doc" -c q
My favorite file type isn't supported!
Relax! You just have to adjust 'commentstring'
:
autocmd FileType apache setlocal commentstring=#\ %s
Self-Promotion
Like commentary.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.
License
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See :help license
.
Recommend
-
186
pathogen.vim Manage your 'runtimepath' with ease. In practical terms, pathogen.vim makes it super easy to install plugins and runtime files in their own private directories. For new users, I recommend using Vi...
-
133
fugitive.vim Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim? Either way, it's "so awesome, it should be illegal". That's why it's called Fugitive. The crown jewel of Fugitive is :G...
-
206
Files Permalink Latest commit message Commit time...
-
156
rails.vim This is a massive (in a good way) Vim plugin for editing Ruby on Rails applications. Easy navigation of the Rails directory structure. gf considers context and knows about partials, fixtures, and m...
-
203
Vim Markdown runtime files This is the development version of Vim's included syntax highlighting and filetype plugins for Markdown. Generally you don't need to install these if you are running a recent version of Vim. If you want...
-
85
vim-cucumber - Vim Cucumber runtime files
-
70
README.markdown speeddating.vim Take the following date: 1999-12-31 Because Vim treats the hyphen as a negative sign, pressing <C-A> on the 31...
-
104
README.markdown eunuch.vim Vim sugar for the UNIX shell commands that need it the most. Features include: :Delete: Delete a buffer and the file on disk simultaneously....
-
43
README.md evil-commentary evil-commentary is an Emacs package for
-
2
vim-sexp mappings for regular people I'm really liking my first impressions of vim-sexp. It's like paredit minus a couple of parts of paredit that are impossibly tricky to implement in...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK