dotar/vim/plugin/htmlescape.vim
2011-11-30 09:34:32 -08:00

16 lines
337 B
VimL

" via: http://vim.wikia.com/wiki/HTML_entities
function HtmlEscape()
silent s/&/\&/eg
silent s/</\&lt;/eg
silent s/>/\&gt;/eg
endfunction
function HtmlUnEscape()
silent s/&lt;/</eg
silent s/&gt;/>/eg
silent s/&amp;/\&/eg
endfunction
map <silent> <c-h> :call HtmlEscape()<CR>
map <silent> <c-u> :call HtmlUnEscape()<CR>