dotar/vim/plugin/htmlescape.vim

16 lines
337 B
VimL
Raw Normal View History

2011-12-01 01:34:32 +08:00
" 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>