From f870fb56c989965cae717255ac30c1a08ad6c466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A8danickblouin=C2=A8?= Date: Mon, 24 Apr 2023 09:35:53 -0400 Subject: [PATCH] Added cheats for vim-surround --- vim-plugins/vim-surround | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 vim-plugins/vim-surround 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 + dst

foo

=> 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