I often come up with abbreviations that should make typing faster, but then I forget they exist. This dilemma especially comes up when I create abbreviations using Tim Pope's vim-abolish - I create hundreds of abbreviations, but can't take full advantage of them. To solve this, Abbreinder works by notifying you when you've typed the expanded form of an abbreviation instead of using the abbreviation functionality.
- Define abbreviations (eg,
iabbrev nvim Neovim
,iabbrev rsvp Répondez, s'il vous plait
,Abolish alg{,s,y} algorithm{,s,ically}
) - Start typing
- If you type an abbreviation's value (eg,
Neovim
) instead of using the trigger, you will get a message reminding you of the abbreviation
Packer
use {
'0styx0/abbreinder.nvim',
requires = {
{
'0styx0/abbremand.nvim',
module = 'abbremand' -- if want to lazy load
}
},
config = function()
-- config can be empty to stay with defaults
-- or anything can be changed, with anything unspecified
-- retaining the default values
require'abbreinder'.setup()
end,
event = 'BufRead', -- if want lazy load
}
Vim-Plug
call plug#begin()
Plug '0styx0/abbremand.nvim'
Plug '0styx0/abbreinder.nvim'
call plug#end()
augroup setup_abbreinder
autocmd!
autocmd BufRead * :lua require'abbreinder'.setup()
augroup END
local config_defaults = {
value_highlight = {
enabled = true,
group = 'Special', -- highlight to use
time = 4000 -- -1 for permanent
},
tooltip = {
enabled = true,
time = 4000, -- time before tooltip closes
opts = {}, -- see :help nvim_open_win
highlight = {
enabled = true,
group = 'Special', -- highlight to use
},
format = function(trigger, value) -- format to print reminder in
return 'abbrev: "' .. trigger .. '"->' .. '"' .. value .. '"'
end,
},
}
While the config here will most likely be kept up to date, feel free to check out ./lua/config.lua for the actual version.
- Takes into account normal mode commands and backspacing while typing
- Close reminders on buffer change or if the abbreviation value is deleted
- Works with abbreviations added/removed on the fly
- Does not trigger if the trigger is the same length as the value, so that abbreviations that correct typos do not remind of incorrect spelling
:AbbreinderEnable
:AbbreinderDisable
require('abbreinder').enable()
require('abbreinder').disable()