diff --git a/vim-plugins/vim-surround b/vim-plugins/vim-surround new file mode 100644 index 00000000..73fda07c --- /dev/null +++ b/vim-plugins/vim-surround @@ -0,0 +1,44 @@ +--- +tags: [ vim,vim-plugins ] +--- + +# https://github.com/tpope/vim-surround + +# To surround with the specified character: +`ys{motion}{character}` +ex: ysiw) foo => (foo) + ysiw( foo => ( foo ) + ysiw] foo => [foo] + ysiw[ foo => [ foo ] + ysiw
foo =>
foo
+ yss} foo => {foo} # surround the whole line with {} (ignores leading whitespace) + ySS} foo => { + foo # indent the line and place it on a new line + } + +# To change the current surrounding character: +`cs{old}{new}` +ex: cs([ (foo) => [foo] + cs[( [foo] => (foo) + cs""foo" =>foo+ +# To delete the current surrounding: +`ds{character}` # delete the surrounding character +`dst` # delete the surrounding HTML tag +ex: ds( (foo) => foo + ds[ [foo] => foo + dstfoo
=> foo + +# To surround with function: +`ysWf{function_name}` +ex: ysWfprint "foo" => print("foo") + ysWFprint "foo" => print( "foo" ) + +# Legend + +ys = "you surround" +b = () +B = {} +r = [] +a = <> +t = HTML tag