Skip to content

Commit

Permalink
Make s:surroundings() public (tpope#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelya committed Nov 23, 2020
1 parent f8238d7 commit 25a8f59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/commentary.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if exists("g:loaded_commentary") || v:version < 700
endif
let g:loaded_commentary = 1

function! s:surroundings() abort
function! commentary#surroundings() abort
return split(get(b:, 'commentary_format', substitute(substitute(substitute(
\ &commentstring, '^$', '%s', ''), '\S\zs%s',' %s', '') ,'%s\ze\S', '%s ', '')), '%s', 1)
endfunction
Expand All @@ -34,7 +34,7 @@ function! s: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\@<!')
Expand Down Expand Up @@ -75,7 +75,7 @@ function! s:go(...) abort
endfunction

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

0 comments on commit 25a8f59

Please sign in to comment.