-
Notifications
You must be signed in to change notification settings - Fork 37
Introduce vim surround keymappings
machakann edited this page Apr 3, 2016
·
9 revisions
If you want to use with vim-surround keymappings, add the following line to your vimrc.
runtime macros/sandwich/keymap/surround.vim
ys
, yss
, yS
, ds
, cs
in normal mode and S
in visual mode are available. Not in vim-surround, but dss
and css
are also available, these are similar as ds
and cs
but determine deleted/replaced texts automatically. See the file directly for detail.
Additionally, vim-sandwich provides several textobjects. They would also be helpful, give it a try!
xmap is <Plug>(textobj-sandwich-query-i)
xmap as <Plug>(textobj-sandwich-query-a)
omap is <Plug>(textobj-sandwich-query-i)
omap as <Plug>(textobj-sandwich-query-a)
- Examples
|<---- is( ---->|
{[(a_surrounded_text)]}
|<----- as( ----->|
|<----- is[ ----->|
{[(a_surrounded_text)]}
|<------ as[ ------>|
|<------ is{ ------>|
{[(a_surrounded_text)]}
|<------- as{ ------->|
|< is_ >|
{[(a_surrounded_text)]}
|<- as_ ->|
xmap iss <Plug>(textobj-sandwich-auto-i)
xmap ass <Plug>(textobj-sandwich-auto-a)
omap iss <Plug>(textobj-sandwich-auto-i)
omap ass <Plug>(textobj-sandwich-auto-a)
- Examples
|<---- iss ---->|
{[(a_surrounded_text)]}
|<----- ass ----->|
|<---- iss ---->|
({[a_surrounded_text]})
|<----- ass ----->|
|<---- iss ---->|
[({a_surrounded_text})]
|<----- ass ----->|
xmap im <Plug>(textobj-sandwich-literal-query-i)
xmap am <Plug>(textobj-sandwich-literal-query-a)
omap im <Plug>(textobj-sandwich-literal-query-i)
omap am <Plug>(textobj-sandwich-literal-query-a)
- Examples
|< im_ >|
{[(a_surrounded_text)]}
|<- am_ ->|