ブロガーを支援するいくつかの機能とvimコマンド。
彼らは何をしていますか?二重のマイナスとマイナスを、端 に スペースがある長いダッシュ ( —)の不可解な
スペースに変更し 、引用符「クリスマスツリー」に引用符「秒」を付けます。
使い方は?コードを.vimrcにコピーし、vimを開いて、次のように記述します。
浸透しますが、小さい名前は「E-Type」です。
次に、コマンドモードで:
:HTMLLineRU <CR>
どこで
-- Enter.
:
, «E-Type» — !
:
, «E-Type» — !
:
" HTML typo {{{ "" Convert text line to HTML line function! HTMLLineRU(line) "" convert to hello — world: "" hello −- world "" hello--world "" hello - world let patt = '\(\s*--\s*\)\|\( - \)\|\(\s*—\s*\)' let line = substitute(a:line, patt, '\ \— ', "g") "" «russian quotes» "" convert "hello world" to «hello world» let patt_match = '"\zs.\{-}\ze"' let patt_subs = '".\{-}"' let matched = matchstr(line, patt_match) while matched != "" let line = substitute(line, patt_subs, '\«'.escape(matched, '\&*[]?
-- Enter.
:
, «E-Type» — !
:
, «E-Type» — !
:
" HTML typo {{{ "" Convert text line to HTML line function! HTMLLineRU(line) "" convert to hello — world: "" hello −- world "" hello--world "" hello - world let patt = '\(\s*--\s*\)\|\( - \)\|\(\s*—\s*\)' let line = substitute(a:line, patt, '\ \— ', "g") "" «russian quotes» "" convert "hello world" to «hello world» let patt_match = '"\zs.\{-}\ze"' let patt_subs = '".\{-}"' let matched = matchstr(line, patt_match) while matched != "" let line = substitute(line, patt_subs, '\«'.escape(matched, '\&*[]?%').'\»', "") let matched = matchstr(line, patt_match) endwhile let patt = '«' let line = substitute(line, patt, '\«', "g") let patt = '»' let line = substitute(line, patt, '\»', "g") return line endfunction function! HTMLLines(line1, line2) let sourceLines = getline(a:line1, a:line2) if bufloaded("scratch_html_lines") :bdelete html_lines endif :new scratch_html_lines :setlocal buftype=nofile :setlocal noswapfile let lineidx = 1 for line in sourceLines call setline(lineidx, HTMLLineRU(line)) let lineidx+=1 endfor endfunction command! -range=% HTMLLineRU call HTMLLines(expand(<line1>), expand(<line2>)) " }}}
PS
, . :)
PPS
wiki , , * * .
PPPS
vim ? :)
-- Enter.
:
, «E-Type» — !
:
, «E-Type» — !
:
" HTML typo {{{ "" Convert text line to HTML line function! HTMLLineRU(line) "" convert to hello — world: "" hello −- world "" hello--world "" hello - world let patt = '\(\s*--\s*\)\|\( - \)\|\(\s*—\s*\)' let line = substitute(a:line, patt, '\ \— ', "g") "" «russian quotes» "" convert "hello world" to «hello world» let patt_match = '"\zs.\{-}\ze"' let patt_subs = '".\{-}"' let matched = matchstr(line, patt_match) while matched != "" let line = substitute(line, patt_subs, '\«'.escape(matched, '\&*[]?
-- Enter.
:
, «E-Type» — !
:
, «E-Type» — !
:
" HTML typo {{{ "" Convert text line to HTML line function! HTMLLineRU(line) "" convert to hello — world: "" hello −- world "" hello--world "" hello - world let patt = '\(\s*--\s*\)\|\( - \)\|\(\s*—\s*\)' let line = substitute(a:line, patt, '\ \— ', "g") "" «russian quotes» "" convert "hello world" to «hello world» let patt_match = '"\zs.\{-}\ze"' let patt_subs = '".\{-}"' let matched = matchstr(line, patt_match) while matched != "" let line = substitute(line, patt_subs, '\«'.escape(matched, '\&*[]?%').'\»', "") let matched = matchstr(line, patt_match) endwhile let patt = '«' let line = substitute(line, patt, '\«', "g") let patt = '»' let line = substitute(line, patt, '\»', "g") return line endfunction function! HTMLLines(line1, line2) let sourceLines = getline(a:line1, a:line2) if bufloaded("scratch_html_lines") :bdelete html_lines endif :new scratch_html_lines :setlocal buftype=nofile :setlocal noswapfile let lineidx = 1 for line in sourceLines call setline(lineidx, HTMLLineRU(line)) let lineidx+=1 endfor endfunction command! -range=% HTMLLineRU call HTMLLines(expand(<line1>), expand(<line2>)) " }}}
PS
, . :)
PPS
wiki , , * * .
PPPS
vim ? :)