A simple Neovim plugin for the Linux command
dict which shows the definitions in a popup
- Lua 82.4%
- Vim Script 17.1%
- Makefile 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| after/syntax | ||
| doc | ||
| lua/dict-popup | ||
| .editorconfig | ||
| .gitignore | ||
| .luacheckrc | ||
| .stylua.toml | ||
| CHANGELOG.md | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| screenshot.png | ||
A simple plugin for the Linux command dict which shows the definitions in a popup. (vim9script version)
Features
- 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
Install
Command
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
Plugin
{
"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!
Dict buffer keymaps
<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-]>" },
},
},
}
TODO
- 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
