Skip to content

Instantly share code, notes, and snippets.

@sooop

sooop/Surrounding.vim Secret

Last active Aug 29, 2015
Embed
What would you like to do?
function! SurroundThings(mode)
let s:m = input("Marker: ")
let s:v = ""
if a:mode == 1
let s:v = "viw"
endif
exec "normal ".s:v."\<esc>`>a</".s:m.">\<esc>`<i<".s:m.">\<esc>`>l".len(s:m)."l"
endfunction
nnoremap <leader>? :call SurroundThings(1)<cr>
vnoremap <leader>? :call SurroundThings(0)<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment