vim技巧之取词翻译III
By lerosua | 七月 16, 2010
以前写过vim里用sdcv取词的一系列文章。
按一个快捷键能调出窗口来显示sdcv的翻译结果,但它不能方便地调用关闭。也就是用同一个快捷键开关窗口。如今此vim脚本有了进化,加了如此功能。
全部脚本如下:
let s:w_mywin=0 function! Mydict() if s:w_mywin let s:w_mywin=0 set nu! close file return endif let s:w_mywin=1 let expl=system('sdcv -n ' . \ expand("<cword>")) windo if \ expand("%")=="diCt.css" | \ q!|endif botright vertical 25split diCt.css setlocal buftype=nofile bufhidden=hide noswapfile set nu! 1s/^/\=expl/ 1 endfunction nmap <silent> <f2> :call Mydict()<CR>
将之保存为sdcv.vim,放到~/.vim/plugin即可。
详细信息参考:
vim技巧之取词翻译II
VIM技巧:VIM里快速翻译单词
Topics: 程序技巧 | 评论关闭
Comments are closed.

