Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make s:surroundings() public #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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") || &cp || 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(
\ &commentstring, '\S\zs%s',' %s','') ,'%s\ze\S', '%s ', '')), '%s', 1)
endfunction
Expand All @@ -28,7 +28,7 @@ function! s:go(type,...) 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 @@ -62,7 +62,7 @@ function! s:go(type,...) abort
endfunction

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