My Ubuntu version is Ubuntu 10.10,
1. First install sdcv:
Root@linuxidc.com :~ # Apt-Get install sdcv
2. Install Dictionary data
The downloaded dictionary is: langdao-EC-GB Dictionary (En-zh_cn) langdao English-Chinese dictionary. The downloaded package name is: stardict-langdao-EC-GB-2.4.2.tar.bz2 (this package is also available in many csdn)
3. decompress the compressed package to the/usr/share/stardict/DIC directory (if this directory is not available, create it manually ).
4.
Now, you can search for words by typing sdcv on the terminal.
Root@linuxidc.com:/# sdcv star
Found 1 items, similar to star.
--> Lang Dao English-Chinese dictionary 5.0
--> Star
* [St region:]
N. stars, luck, stars
Vt. Decorated with stars and marked with asterisks to become stars
Vi. Become a star
[Medical] stars, stars
5. But we also need to use the word query function in Vim. Add the following statement in the vim configuration file:
Root@linuxidc.com:/# Vim/etc/Vim/vimrc
Add at the end:
Function! Mydict ()
Let expl = System ('sdcv-n '.
\ Expand (""))
Windo if
\ Expand ("%") = "dict-TMP" |
\ Q! | Endif
25vsp dict-TMP
Setlocal buftype = nofile bufhidden = hide noswapfile
1 S/^/\ = expl/
1
Endfunction
Nmap f: Call mydict ()
In the file opened with vim, press SHIFT + F at the cursor word, and press enter to view the word.