Permalink
Browse files

Support custom maps

Closes #2
  • Loading branch information...
1 parent 8647be4 commit 6876b3e8b45b68606e8015a8cba3cd1eddfe93c5 @tpope committed Aug 28, 2011
Showing with 9 additions and 11 deletions.
  1. +0 −8 README.markdown
  2. +9 −3 plugin/commentary.vim
View
@@ -39,14 +39,6 @@ Relax! You just have to adjust `'commentstring'`:
autocmd FileType apache set commentstring=#\ %s
-> What if I want custom maps?
-
-Fly by the seat of your pants and map directly to the `\` maps:
-
- xmap gc \\
- nmap gc \\
- nmap gcc \\\
-
Contributing
------------
View
@@ -46,8 +46,14 @@ function! s:go(type) abort
endif
endfunction
-xnoremap <silent> \\ :<C-U>call <SID>go(visualmode())<CR>
-nnoremap <silent> \\ :<C-U>set opfunc=<SID>go<CR>g@
-nnoremap <silent> \\\ :<C-U>call <SID>go(v:count1)<CR>
+xnoremap <silent> <Plug>Commentary :<C-U>call <SID>go(visualmode())<CR>
+nnoremap <silent> <Plug>Commentary :<C-U>set opfunc=<SID>go<CR>g@
+nnoremap <silent> <Plug>CommentaryLine :<C-U>call <SID>go(v:count1)<CR>
+
+if maparg('\\') ==# ''
+ xmap \\ <Plug>Commentary
+ nmap \\ <Plug>Commentary
+ nmap \\\ <Plug>CommentaryLine
+endif
" vim:set sw=2 sts=2:

0 comments on commit 6876b3e

Please sign in to comment.