vimtwitter.vimメモ
Mac付属のvimだと問題なかったのだが、WindowsXPに入れたVIM version 7.1 (KaoriYa.net版)だと
vimtwitter.vimで日本語が投稿できなかったのでメモ
vimtwitter.vim
http://www.vim.org/scripts/script.php?script_id=2124
macの場合は .vim/plugin/ に
Windowsで僕の環境の場合vimのパスが通ってる場所の runtime/plugin/ に
環境変数HOME下に .vimrc を作成して
let vimtwitter_login="USER:PASS"
を追加
WindowsでVIM(KaoriYa.net)の場合、2バイト文字に対応させる
以下でパッチが公開されている
http://blog.cheki.net/archives/1219
57,59c57,64 < let mesg = substitute(mesg, '%', '%25', "g") < let mesg = substitute(mesg, '"', '%22', "g") < let mesg = substitute(mesg, '&', '%26', "g") --- > if has('iconv') > let mesg = iconv(mesg, &encoding, 'utf-8') > let mesg = substitute(mesg, '[^ a-zA-Z0-9_.-]', '\=s:Char2Hex(submatch(0))', 'g') > elseif > let mesg = substitute(mesg, '%', '%25', "g") > let mesg = substitute(mesg, '"', '%22', "g") > let mesg = substitute(mesg, '&', '%26', "g") > endif 63a69,86 > endfunction > > function! s:Char2Hex(c) > let n = char2nr(a:c) > let r = '' > > while n > let r = '0123456789ABCDEF'[n % 16] . r > let n = n / 16 > endwhile > > if strlen(r) % 2 == 1 > let r = '0' . r > endif > > let r = substitute(r, '..', '%\0', 'g') > > return r
わかりにくいがパッチの「63a68,86」という記述以下の部分は
post_twitter関数とCmdLine_Twitter関数の間に新しくChar2Hex関数を追加する感じで。
vimtwitter.vimのversion5.0しかみてないがその場合
パッチの上記の箇所は、最初の「endfunction」がいらなくて最後に「endfunction」が欠けてるのかな…