Skip to content

Instantly share code, notes, and snippets.

@graywh
Created October 22, 2012 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graywh/3932293 to your computer and use it in GitHub Desktop.
Save graywh/3932293 to your computer and use it in GitHub Desktop.
Testing surround.vim's cs with multi-line braces
{
foo
bar
baz
}
(
foo
bar
baz
)
something {
foo
bar
baz
}
something (
foo
bar
baz
)
(
foo
bar
baz
)
{
foo
bar
baz
}
something ( foo
bar
baz
)
something { foo
bar
baz
}
(
foo
bar
baz
)
{
foo
bar
baz
}
something ( foo
bar
baz
)
something { foo
bar
baz
}
let s:changes = [
\ ['a', 2, '{(', '})'],
\ ['b', 8, '({', ')}'],
\ ['c', 14, '{(', '})'],
\ ['d', 20, '({', ')}'],
\ ]
function SetMarks()
for change in s:changes
exec change[1] 'mark' change[0]
endfor
endfunction
function MakeChanges(w)
for change in s:changes
exec 'normal `'.change[0].'$cs'.change[a:w]
endfor
endfunction
set noautoindent nosmartindent nocindent indentexpr=
let g:surround_indent = 0
edit input
call SetMarks()
call MakeChanges(2)
saveas! output1
edit input
call SetMarks()
call MakeChanges(3)
saveas! output2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment