Skip to content

Commit a8ac559

Browse files
committed
Make surroundings function public
Integrate tpope#51
1 parent 3b01e29 commit a8ac559

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

autoload/commentary.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function! s:surroundings() abort
1+
function! commentary#surroundings() abort
22
return split(get(b:, 'commentary_format', substitute(substitute(
33
\ &commentstring, '\S\zs%s',' %s','') ,'%s\ze\S', '%s ', '')), '%s', 1)
44
endfunction
@@ -24,7 +24,7 @@ function! commentary#go(...) abort
2424
let [lnum1, lnum2] = [line("'["), line("']")]
2525
endif
2626

27-
let [l, r] = s:surroundings()
27+
let [l, r] = commentary#surroundings()
2828
let uncomment = 2
2929
for lnum in range(lnum1,lnum2)
3030
let line = matchstr(getline(lnum),'\S.*\s\@<!')
@@ -59,7 +59,7 @@ function! commentary#go(...) abort
5959
endfunction
6060

6161
function! commentary#textobject(inner) abort
62-
let [l, r] = s:surroundings()
62+
let [l, r] = commentary#surroundings()
6363
let lnums = [line('.')+1, line('.')-2]
6464
for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']]
6565
while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r)

plugin/commentary.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if exists("g:loaded_commentary") || v:version < 700
88
endif
99
let g:loaded_commentary = 1
1010

11-
command! -range -bar Commentary call s:go(<line1>,<line2>)
11+
command! -range -bar Commentary call commentary#go(<line1>,<line2>)
1212
xnoremap <silent> <Plug>Commentary :Commentary<CR>
1313
nnoremap <expr> <Plug>Commentary commentary#go()
1414
nnoremap <expr> <Plug>CommentaryLine commentary#go() . '_'

0 commit comments

Comments
 (0)