Add an English dictionary for vim in Ubuntu

Source: Internet
Author: User
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"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.