Skip to content

Instantly share code, notes, and snippets.


sooop/Surrounding.vim Secret

Last active Aug 29, 2015
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"
exec "normal ".s:v."\<esc>`>a</".s:m.">\<esc>`<i<".s:m.">\<esc>`>l".len(s:m)."l"
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