为了能在vim中使用字典工具,通过sdcv(console version of StarDict program)控制台stardict结合
vim配置文件。
1.sdcv 安装
sudo yum install sdcv
2.sdcv字典文件安装
字典文件获取: http://abloz.com/huzheng/stardict-dic/wget http://abloz.com/huzheng/stardict-dic/zh_CN/stardict-langdao-ec-gb-2.4.2.tar.bz2
wget http://abloz.com/huzheng/stardict-dic/zh_CN/stardict-langdao-ce-gb-2.4.2.tar.bz2
wget http://abloz.com/huzheng/stardict-dic/zh_CN/stardict-oxford-gb-2.4.2.tar.bz2
tar -xjvf stardict-langdao-ec-gb-2.4.2.tar.bz2 -C /usr/share/stardict/dic
3.sdcv终端下使用
[~@localhost StarDict]$ sdcv
Enter word or phrase: hi
Found 1 items, similar to hi.
-->朗道英汉字典5.0
-->hi
*[hai]
interj. 喂
Enter word or phrase:
3.VIM配置
56 "--------------------------------------------------------------------------------
57 "" 英文字典 sdcv
58 "--------------------------------------------------------------------------------
59 "鼠标取词
60 "function Get_mouse_word()
61 " let expl=system('sdcv -n' .
62 " \ v:beval_text .
63 " \ '|fmt -cstw 40')
64 " return expl
65 "endfunction
66 "set bexpr=Get_mouse_word()
67 "set beval
68
69 "光标取词
70 function Get_cursor_word()
71 let expl=system('sdcv -n ' .
72 \ expand("<cword>"))
73 windo if
74 \ expand("%")=="diCt-tmp" |
75 \ q!|endif
76 25vsp diCt-tmp
77 setlocal buftype=nofile bufhidden=hide noswapfile
78 1s/^/\=expl/
79 1
80 endfunction
81 nmap F :call Get_cursor_word()<CR>