From a8ac559e8b36a19ada8cf5cfab207407610a2f5b Mon Sep 17 00:00:00 2001 From: somini Date: Tue, 24 Apr 2018 11:09:53 +0100 Subject: [PATCH] Make surroundings function public Integrate #51 --- autoload/commentary.vim | 6 +++--- plugin/commentary.vim | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/commentary.vim b/autoload/commentary.vim index 4338997..0ed02e8 100644 --- a/autoload/commentary.vim +++ b/autoload/commentary.vim @@ -1,4 +1,4 @@ -function! s:surroundings() abort +function! commentary#surroundings() abort return split(get(b:, 'commentary_format', substitute(substitute( \ &commentstring, '\S\zs%s',' %s','') ,'%s\ze\S', '%s ', '')), '%s', 1) endfunction @@ -24,7 +24,7 @@ function! commentary#go(...) abort let [lnum1, lnum2] = [line("'["), line("']")] endif - let [l, r] = s:surroundings() + let [l, r] = commentary#surroundings() let uncomment = 2 for lnum in range(lnum1,lnum2) let line = matchstr(getline(lnum),'\S.*\s\@,) +command! -range -bar Commentary call commentary#go(,) xnoremap Commentary :Commentary nnoremap Commentary commentary#go() nnoremap CommentaryLine commentary#go() . '_'