Last active
January 30, 2020 21:09
-
-
Save nbardiuk/58d342e085f4f1ad2fa4d193097526e6 to your computer and use it in GitHub Desktop.
Vim escape javascript string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" paste escaped java/javascript string | |
nmap <leader>jp :call setreg('e', json_encode(@+))\| normal "ep<CR> | |
xmap <leader>jp :<C-U>call setreg('e', json_encode(@+))\| normal gv"ep<CR> | |
nmap <leader>jP :call setreg('e', json_encode(@+))\| normal "eP<CR> | |
" yank unescaped java/javascript string | |
xmap <leader>jy :<C-U>execute 'normal! gv"ey'\| :call setreg('+', json_decode(@e))<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment