Created
October 22, 2012 16:12
-
-
Save graywh/3932293 to your computer and use it in GitHub Desktop.
Testing surround.vim's cs with multi-line braces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
foo | |
bar | |
baz | |
} | |
( | |
foo | |
bar | |
baz | |
) | |
something { | |
foo | |
bar | |
baz | |
} | |
something ( | |
foo | |
bar | |
baz | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
foo | |
bar | |
baz | |
) | |
{ | |
foo | |
bar | |
baz | |
} | |
something ( foo | |
bar | |
baz | |
) | |
something { foo | |
bar | |
baz | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
foo | |
bar | |
baz | |
) | |
{ | |
foo | |
bar | |
baz | |
} | |
something ( foo | |
bar | |
baz | |
) | |
something { foo | |
bar | |
baz | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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