From a497687e482eb802be4d899f826e00bcb9f1cbaf Mon Sep 17 00:00:00 2001 From: Will Gray Date: Tue, 20 Mar 2012 12:52:51 -0500 Subject: [PATCH] Use so the function can be script-local Also provides something nice for users to map to when they don't want to use --- plugin/double-tap.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/double-tap.vim b/plugin/double-tap.vim index 6f7074e..a32692f 100644 --- a/plugin/double-tap.vim +++ b/plugin/double-tap.vim @@ -42,7 +42,7 @@ let s:commStart = {} " dict to hold the comment starters using " This function returns a regular if the current line " is not simply an empty comment. Otherwise it clears the line -function! Doubletap_detect_empty_comment() +function! s:Detect_empty_comment() " Captures the comment starter if necessary; only once per filetype if !has_key(s:commStart, &ft) let s:commStart[&ft] = substitute(&comments, s:pattern, '\2', '') @@ -55,7 +55,11 @@ function! Doubletap_detect_empty_comment() endif endfunction -inoremap Doubletap_detect_empty_comment() +if !hasmapto('DoubletapDetect') + inoremap DoubletapDetect +endif + +inoremap DoubletapDetect Detect_empty_comment() " Teardown:{{{1 "reset &cpo back to users setting