When reading documents in vim, I often find words that I don't know. I used to directly press ctrl + c to translate them in google, which is very troublesome. So I want to find a method that is similar to Kingsoft's software, but it is a tool used in vim of linux. Sdcv is all called stardict...
When reading documents in vim, I often find words that I don't know. I used to directly press ctrl + c to translate them in google, which is very troublesome. So I want to find a method that is similar to Kingsoft's software, but it is a tool used in vim of linux.
Sdcv is called stardict console version, which is the dictionary under the terminal. it is found that most of the users found on the Internet use this tool, so they also want to give it a try.
My ubuntu version is ubuntu-10.10,
1. first install sdcv:
Root @ ubuntu :~ # Apt-get install sdcv
2. install dictionary data. Previously, only sdcv without data is installed. The dictionary is:
Http://yeelou.com/huzheng/stardict-dic/zh_CN/
The dictionary I downloaded 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.
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 @ ubuntu:/# 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 @ ubuntu:/# 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 to view the word.
====
Author: "move against the water, move back-min Shao"