turn fancy spell suggest ui into a lambda, and fix some styling
This commit is contained in:
@ -41,13 +41,13 @@ map('n', ']]', '<cmd>tabn<CR>')
|
||||
|
||||
-- good spell suggestion ui
|
||||
-- (stolen from https://github.com/neovim/neovim/pull/25833)
|
||||
vim.keymap.set('n', 'z=', function()
|
||||
local spell_on_choice = vim.schedule_wrap(function(_, idx)
|
||||
if type(idx) == 'number' then
|
||||
vim.cmd('normal! '..idx..'z=')
|
||||
end
|
||||
end)
|
||||
|
||||
local spellsuggest_select = function()
|
||||
if vim.v.count > 0 then
|
||||
spell_on_choice(nil, vim.v.count)
|
||||
return
|
||||
@ -55,6 +55,4 @@ local spellsuggest_select = function()
|
||||
local cword = vim.fn.expand('<cword>')
|
||||
local prompt = 'Change '..vim.inspect(cword)..' to:'
|
||||
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice)
|
||||
end
|
||||
|
||||
vim.keymap.set('n', 'z=', spellsuggest_select, { desc = 'Shows spelling suggestions' })
|
||||
end, { desc = 'Shows spelling suggestions' })
|
||||
|
Reference in New Issue
Block a user