1
0
Fork 0

nvim: make spelling suggestions nicer

This commit is contained in:
tastytea 2022-09-26 19:04:32 +02:00
parent d205ed4974
commit 1c3d120b91
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 14 additions and 0 deletions

View File

@ -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)