02/12/30 00:17
HTML で困るものをエスケープするスクリプトを書いたんですが、
範囲選択の後に :'<,'>call HtmlEscape と入力しなければならないです。
そうじゃなくて、:'<,'>HtmlEscape にするにはどうすればいいの?
# command あたりがあやしかったがわからなかった...
if exists("loaded_html_escape")
finish
endif
let loaded_html_escape = 1
function HtmlEscape() range
let index = a:firstline
while index <= a:lastline
let line = getline(index)
let line = substitute(line, "&", "\\&", "g")
let line = substitute(line, "<", "\\<", "g")
let line = substitute(line, ">", "\\>", "g")
call setline(index, line)
let index = index + 1
endwhile
endfunction