Skip to content

Instantly share code, notes, and snippets.

@sooop
Created January 2, 2020 16:16
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/c956a2f37e2f0ab5de8a9965f4711812 to your computer and use it in GitHub Desktop.
Save sooop/c956a2f37e2f0ab5de8a9965f4711812 to your computer and use it in GitHub Desktop.
" using `<Plug>` map
mes clear
let s:save_cpo = &cpo
set cpo&vim
function! s:highlightSelection()
let l:temp = @@
normal! gvy
let @/ = '\V'. substitute(escape(@@, '\'), "\n", '\n', 'g')
let @@ = l:temp
endfunction
noremap <script> <Plug>ScmHighlight :<C-u>call <SID>highlightSelection()<CR>
vmap <leader># <Plug>ScmHighlight
let &cpo = s:save_cpo
unlet s:save_cpo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment