# surround define-command -hidden -params 1 xml-surround-add-impl %~ evaluate-commands -save-regs 'a' -no-hooks %^ set-register a %arg{1} execute-keys -draft '_iaa/a' ^ ~ define-command -hidden -params 1 xml-surround-remove-impl %~ evaluate-commands -save-regs 'a"' -no-hooks %^ set-register a %arg{1} execute-keys -save-regs '"' -draft 'ad//ad' ^ ~ define-command xml-surround-add %{ prompt add: %{ xml-surround-add-impl %val{text} } } define-command xml-surround-remove %{ prompt remove: %{ xml-surround-remove-impl %val{text} } } hook global WinSetOption filetype=(xml|html|markdown) %{ declare-filetype-mode %opt{filetype} map window %opt{filetype} s ': xml-surround-add' -docstring 'tag surround add' map window %opt{filetype} d ': xml-surround-remove' -docstring 'tag surround remove' }