From e888c60acc2d38356f57482fb9f3a7e0865b8057 Mon Sep 17 00:00:00 2001 From: yzy1 Date: Thu, 18 Jun 2020 09:54:38 +0800 Subject: [PATCH] Added an option to disable the default keymap --- plugin/commentary.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/commentary.vim b/plugin/commentary.vim index 17c285b..ceaaa34 100644 --- a/plugin/commentary.vim +++ b/plugin/commentary.vim @@ -103,7 +103,11 @@ onoremap Commentary :call textobject(get(v:, 'op nnoremap ChangeCommentary c:call textobject(1) nmap CommentaryUndo :echoerr "Change your CommentaryUndo map to CommentaryCommentary" -if !hasmapto('Commentary') || maparg('gc','n') ==# '' + +if !exists('g:commentary_bind_keys') + let g:commentary_bind_keys = 1 +endif +if g:commentary_bind_keys && (!hasmapto('Commentary') || maparg('gc','n') ==# '') xmap gc Commentary nmap gc Commentary omap gc Commentary