A simple plugin for the Linux command dict
which shows the definitions in a popup. (vim9script version)
- center and cursor popups
- ex command:
:Dict {word}
(center) - normal mode: lookup current word (cursor)
- visual mode: lookup selection (cursor)
dict
filetype and accompanying syntax- in-buffer pseudo jumplist
sudo apt install dictd
# or
sudo dnf install dictd
# extra dictionaries
sudo apt install dict-jargon dict-vera
Note: Syntax tested with gcide (default), jargon and vera
{
"Nealium/dict-popup.nvim",
opts = {
normal_mapping = nil, -- disable
visual_mapping = "<Leader>h",
visual_reg = "*",
stack = false,
},
}
Notes:
- Setting
normal_mapping
orvisual_mapping
tonil
(actual nil, not a string), or leaving the keys out all together, will disable the mapping. - Setting
stack
totrue
will open up a cursor popup on top of a center popup instead of the default behavior which is to overwrite the center popup's contents. This may lead you with the center popup open and unfocused, to refocus do<C-w><C-w>
- in some situations this won't work and you are on your own!
<ESC>
andq
close popup}
next definition{
previous definition<C-O>
next in search jumplist<C-I>
and<TAB>
previous in search jumplist<C-]>
search current word- if stacked,
<C-W>
close popup
Keymaps can be changed through the opts key buffer_mappings
:
{
"Nealium/dict-popup.nvim",
opts = {
normal_mapping = "<Leader>h",
visual_mapping = "<Leader>h",
visual_reg = "*",
stack = false,
buffer_mappings = { -- defaults
close = { "<Esc>", "q" },
next_definition = { "}" },
previous_definition = { "{" },
jump_back = { "<C-o>" },
jump_forward = { "<C-i>", "<Tab>" },
jump_definition = { "<C-]>" },
},
},
}
- Proper config & setup
- Center popup for
:Dict
command - Ability to call
dict.Cursor
inside of a dict popup and have it overwrite the current contents - Colors set in config