2014-03-11 16:10:50 -04:00
|
|
|
# commentary.vim
|
2014-03-02 09:35:00 -05:00
|
|
|
|
|
|
|
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
|
2014-04-18 08:58:02 -04:00
|
|
|
comment out a paragraph), `gc` in visual mode to comment out the selection,
|
2014-07-02 07:18:18 -04:00
|
|
|
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.
|
2014-03-02 09:35:00 -05:00
|
|
|
|
|
|
|
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](https://github.com/tomtom/tcomment_vim)). Striving for
|
|
|
|
minimalism, it weighs in at under 100 lines of code.
|
|
|
|
|
2014-04-18 08:58:02 -04:00
|
|
|
Oh, and it uncomments, too. The above maps actually toggle, and `gcgc`
|
|
|
|
uncomments a set of adjacent commented lines.
|
2014-03-02 09:35:00 -05:00
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
## Installation
|
2014-03-02 09:35:00 -05:00
|
|
|
|
2018-07-19 08:52:53 -04:00
|
|
|
Install using your favorite package manager, or use Vim's built-in package
|
|
|
|
support:
|
2014-03-02 09:35:00 -05:00
|
|
|
|
2018-07-19 08:52:53 -04:00
|
|
|
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
|
2014-03-02 09:35:00 -05:00
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
## FAQ
|
2014-03-02 09:35:00 -05:00
|
|
|
|
|
|
|
> My favorite file type isn't supported!
|
|
|
|
|
|
|
|
Relax! You just have to adjust `'commentstring'`:
|
|
|
|
|
2015-12-08 08:20:04 -05:00
|
|
|
autocmd FileType apache setlocal commentstring=#\ %s
|
2014-03-02 09:35:00 -05:00
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
## Self-Promotion
|
2014-03-02 09:35:00 -05:00
|
|
|
|
|
|
|
Like commentary.vim? Follow the repository on
|
|
|
|
[GitHub](https://github.com/tpope/vim-commentary) and vote for it on
|
|
|
|
[vim.org](http://www.vim.org/scripts/script.php?script_id=3695). And if
|
|
|
|
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
|
|
|
[Twitter](http://twitter.com/tpope) and
|
|
|
|
[GitHub](https://github.com/tpope).
|
|
|
|
|
2014-03-11 16:10:50 -04:00
|
|
|
## License
|
2014-03-02 09:35:00 -05:00
|
|
|
|
|
|
|
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
|
|
|
See `:help license`.
|