Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 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
Comment stuff out. Use `<leader>cc` to comment out a line (takes a count),
`<leader>c` to comment out the target of a motion (for example, `<leader>cap` to
comment out a paragraph), `<leader>c` in visual mode to comment out the selection,
and `<leader>c` 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.

Expand All @@ -13,7 +13,7 @@ feature (I overlooked
[tcomment.vim](https://github.com/tomtom/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`
Oh, and it uncomments, too. The above maps actually toggle, and `<leader>c<leader>c`
uncomments a set of adjacent commented lines.

## Installation
Expand Down
12 changes: 6 additions & 6 deletions plugin/commentary.vim
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ nnoremap <expr> <Plug>CommentaryLine <SID>go() . '_'
onoremap <silent> <Plug>Commentary :<C-U>call <SID>textobject(get(v:, 'operator', '') ==# 'c')<CR>
nnoremap <silent> <Plug>ChangeCommentary c:<C-U>call <SID>textobject(1)<CR>

if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
xmap gc <Plug>Commentary
nmap gc <Plug>Commentary
omap gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine
nmap gcu <Plug>Commentary<Plug>Commentary
if !hasmapto('<Plug>Commentary') || maparg('<leader>c','n') ==# ''
xmap <leader>c <Plug>Commentary
nmap <leader>c <Plug>Commentary
omap <leader>c <Plug>Commentary
nmap <leader>cc <Plug>CommentaryLine
nmap <leader>cu <Plug>Commentary<Plug>Commentary
endif

nmap <silent> <Plug>CommentaryUndo :echoerr "Change your <Plug>CommentaryUndo map to <Plug>Commentary<Plug>Commentary"<CR>
Expand Down