Skip to content

Instantly share code, notes, and snippets.

@sooop
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sooop/64a222fcf8b5ed5f9518 to your computer and use it in GitHub Desktop.
Save sooop/64a222fcf8b5ed5f9518 to your computer and use it in GitHub Desktop.
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