GithubHelp home page GithubHelp logo

dict.nvim's Introduction

Dict.nvim

  • Display in a floating window the result of dict for the word under the cursor.

  • Special highlighting for WordNet, The Collaborative International Dictionary of English, and FreeDict Dictionary.

  • Replace the word under the cursor with one chosen from dict results.

  • Use telescope.nvim to show the list of words in installed dictionaries if the word under cursor is not found by dict.

Installation

  • Install dict.nvim as any other Neovim plugin.

  • Install telescope.nvim.

  • Install dict, dictd and at least one dictionary. On Debian/Ubuntu systems, you can use apt to install them. Example:

    sudo apt install dict dictd dict-wn dict-gcide dict-freedict-por-eng
    

Configuration

Mandatory

You have to create a key binding to run dict.nvim. Example for init.lua:

vim.keymap.set('n', '<Leader>d', '<Cmd>lua require("dict").lookup()<CR>')

You have also to call the setup function:

require'dict'.setup()

Optional

By default, dict.nvim will run dict without any argument other than the word being looked up. It will read dictionary indexes from /usr/share/dictd, and will cache the compiled list of words at ~/.cach/dict.nvim. Instead, you can tell dict to search a single dictionary and can also tell dict.nvim where to read the indexes, and where to store its own compiled list of words. Example:

require'dict'.setup({
    dict = 'wn',
    dict_dir = '/usr/share/dictd',
    cache_dir = os.getenv('HOME') .. '/.cache/dict.nvim',
})

On Debian, Ubuntu and other Linux distributions derived from them, to change the order the dictionaries are searched, edit the file /etc/dictd/dictd.order, and run:

sudo dictdconfig -w

and, finally, restart the dictd daemon.

Usage

  • Put the cursor over the word whose definition you want to lookup. Then, press the key binding that you have configured to open a float window with dict results.

  • On the float window, you can:

    • press the same key binding to replace the displayed word definition;

    • press <Enter> to use the current word under the float window cursor to replace the word that was under the cursor in the editor;

    • press either <Esc> or q to quit the float window.

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.