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)
dictfiletype and accompanying syntax- in-buffer pseudo jumplist
sudo apt install dictd
# or
sudo dnf install dictd# extra dictionaries
sudo apt install dict-jargon dict-veraNote: 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_mappingorvisual_mappingtonil(actual nil, not a string), or leaving the keys out all together, will disable the mapping. - Setting
stacktotruewill 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>andqclose 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
:Dictcommand - Ability to call
dict.Cursorinside of a dict popup and have it overwrite the current contents - Colors set in config
