Git Product home page Git Product logo

vim-dict's Introduction

vim-dict

vim-dict is a dict client. It uses curl to connect to dict servers, so make sure you have curl installed.

Installation

Place in ~/.vim/plugin/dict.vim or in case of Pathogen:

cd ~/.vim/bundle
git clone https://github.com/szw/vim-dict.git

Please, don't forget to star the repository if you like (and use) the plugin. This will let me know how many users it has and then how to proceed with further development :).

Usage

To lookup a word (or words) in the dictionary use Dict command:

:Dict hello
:Dict start up

The Dict command uses hosts and databases defined in the g:dict_hosts global list. By default it is set to [["dict.org", ["all"]]] (the format will be explained a bit later).

Dict command can use a word under the cursor. Just move the cursor to a word and type in the command line:

:Dict

The same works on selection - just select multiple words in the Visual mode.

The :Dict command will open a preview window. To close that window you may run :pc, or just hit q if the Dict window is the active one.

Configuration

There are just a few global variables (options) you may set in the .vimrc file.

  • g:dict_hosts

    The most important one is a list g:dict_hosts mentioned earlier. It combines hosts/databases used by vim-dict. The list entries are lists themselves and share the following format:

      ["host_name", ["database1", "database2", ...]]
    

    The sample extract from someone's ~/.vimrc file could look like this:

      let g:dict_hosts = [
          \["dict.org", ["all"]],
          \["dict.mova.org", ["slovnyk_en-pl", "slovnyk_pl-en"]]
      \]
    

    Moreover vim-dict can help you figure out what databases are available on your servers. There is a special command for this:

      :DictShowDb
    

    You can even open your .vimrc and provide some host urls only:

      let g:dict_hosts = [
          \["dict.org", []],
          \["dict.mova.org", []]
      \]
    

    Then save and reload .vimrc, perform DictShowDb and yank-paste the databases you want :).

    The list of DICT servers can be found on the Internet, e.g. here.

    If you have a local server with a dict deamon, you can use:

      let g:dict_hosts = [["localhost", ["*"]]]
    
  • g:dict_leave_pw

    If set to 1 vim-dict leaves the preview window (the focus remains on the current window). By default it is set to 0.

    Example:

      let g:dict_leave_pw = 0
    
  • g:dict_curl_command*

    This variable holds the curl command to be fired by Dict function. You will find it handy if curl is not on your $PATH environment variable. By default it is set to "curl".

    Example:

      let g:dict_curl_command = "curl"
    
  • g:dict_curl_options*

    Sometimes you might want to add additional options to the curl invocation, e.g. additonal proxy settings. By default it defines only the connection timeout. Notice, the option -s (silent) is always present regardless of this variable.

    Example:

      let g:dict_curl_options = "--connect-timeout 30"
    

Useful tips

On Ubuntu you might want to add system dictionary to Vim:

set dictionary+=/usr/share/dict/words

This will enable the dictionary in the insert mode (CTRL-X CTRL-K). Additionaly it could be useful to add the dictionary to the standard word completions (CTRL-N...) for text and Markdown file types. To do this set the complete to include k value:

au FileType text,markdown setlocal complete+=k

License

Copyright © 2012 Szymon Wrozynski. Distributed under the same terms as Vim itself. See :help license

vim-dict's People

Contributors

szw avatar inkarkat avatar smitp avatar

Watchers

NoScripter avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.