samer@3
|
1 # commentary.vim
|
samer@3
|
2
|
samer@3
|
3 Comment stuff out. Use `gcc` to comment out a line (takes a count),
|
samer@3
|
4 `gc` to comment out the target of a motion (for example, `gcap` to
|
samer@3
|
5 comment out a paragraph), `gc` in visual mode to comment out the selection,
|
samer@3
|
6 and `gc` in operator pending mode to target a comment. You can also use
|
samer@3
|
7 it as a command, either with a range like `:7,17Commentary`, or as part of a
|
samer@3
|
8 `:global` invocation like with `:g/TODO/Commentary`. That's it.
|
samer@3
|
9
|
samer@3
|
10 I wrote this because 5 years after Vim added support for mapping an
|
samer@3
|
11 operator, I still couldn't find a commenting plugin that leveraged that
|
samer@3
|
12 feature (I overlooked
|
samer@3
|
13 [tcomment.vim](https://github.com/tomtom/tcomment_vim)). Striving for
|
samer@3
|
14 minimalism, it weighs in at under 100 lines of code.
|
samer@3
|
15
|
samer@3
|
16 Oh, and it uncomments, too. The above maps actually toggle, and `gcgc`
|
samer@3
|
17 uncomments a set of adjacent commented lines.
|
samer@3
|
18
|
samer@3
|
19 ## Installation
|
samer@3
|
20
|
samer@3
|
21 If you don't have a preferred installation method, I recommend
|
samer@3
|
22 installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
samer@3
|
23 then simply copy and paste:
|
samer@3
|
24
|
samer@3
|
25 cd ~/.vim/bundle
|
samer@3
|
26 git clone git://github.com/tpope/vim-commentary.git
|
samer@3
|
27
|
samer@3
|
28 Once help tags have been generated, you can view the manual with
|
samer@3
|
29 `:help commentary`.
|
samer@3
|
30
|
samer@3
|
31 ## FAQ
|
samer@3
|
32
|
samer@3
|
33 > My favorite file type isn't supported!
|
samer@3
|
34
|
samer@3
|
35 Relax! You just have to adjust `'commentstring'`:
|
samer@3
|
36
|
samer@3
|
37 autocmd FileType apache set commentstring=#\ %s
|
samer@3
|
38
|
samer@3
|
39 ## Self-Promotion
|
samer@3
|
40
|
samer@3
|
41 Like commentary.vim? Follow the repository on
|
samer@3
|
42 [GitHub](https://github.com/tpope/vim-commentary) and vote for it on
|
samer@3
|
43 [vim.org](http://www.vim.org/scripts/script.php?script_id=3695). And if
|
samer@3
|
44 you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
samer@3
|
45 [Twitter](http://twitter.com/tpope) and
|
samer@3
|
46 [GitHub](https://github.com/tpope).
|
samer@3
|
47
|
samer@3
|
48 ## License
|
samer@3
|
49
|
samer@3
|
50 Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
samer@3
|
51 See `:help license`.
|