nvim: make spelling suggestions nicer
This commit is contained in:
parent
d205ed4974
commit
1c3d120b91
@ -90,3 +90,17 @@ map('n', '<M-,>', '<C-T>', 'Go back to previous pos')
|
||||
map('v', '<Leader>f', 'gq', 'Reformat text')
|
||||
map('n', '<Leader>h', ':nohlsearch<CR>', 'Stop highlighting search')
|
||||
map('n', '<C-D>', ':bdelete<CR>', 'Close buffer')
|
||||
|
||||
-- use ui.select for spelling suggestions so dressing can make it look nice
|
||||
map('n', 'z=', function()
|
||||
local word = vim.fn.expand('<cword>')
|
||||
local suggestions = vim.fn.spellsuggest(word)
|
||||
vim.ui.select(suggestions, {}, vim.schedule_wrap(function(selected)
|
||||
if selected then
|
||||
vim.api.nvim_feedkeys('ciw' .. selected, 'n', true)
|
||||
vim.api.nvim_feedkeys(
|
||||
vim.api.nvim_replace_termcodes('<Esc>', true, true, true),
|
||||
'n', true)
|
||||
end
|
||||
end))
|
||||
end)
|
||||
|
Loading…
x
Reference in New Issue
Block a user