summaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2024-11-19 13:16:10 -0600
committerSquibid <me@zacharyscheiman.com>2024-11-19 13:16:10 -0600
commit11e1d6080429177c7e0aafc1e9dcb8f800ef4ea4 (patch)
tree717e78e3cb1ae84fef5929925477a538419915c4 /lua
parent09533268946a7884c44fa69ab4ad6ea6a413d862 (diff)
downloadnvim-11e1d6080429177c7e0aafc1e9dcb8f800ef4ea4.tar.gz
nvim-11e1d6080429177c7e0aafc1e9dcb8f800ef4ea4.tar.bz2
nvim-11e1d6080429177c7e0aafc1e9dcb8f800ef4ea4.zip
turn fancy spell suggest ui into a lambda, and fix some styling
Diffstat (limited to '')
-rw-r--r--lua/conf/binds.lua18
1 files changed, 8 insertions, 10 deletions
diff --git a/lua/conf/binds.lua b/lua/conf/binds.lua
index 2031852..34ad3ee 100644
--- a/lua/conf/binds.lua
+++ b/lua/conf/binds.lua
@@ -41,20 +41,18 @@ map('n', ']]', '<cmd>tabn<CR>')
-- good spell suggestion ui
-- (stolen from https://github.com/neovim/neovim/pull/25833)
-local spell_on_choice = vim.schedule_wrap(function(_, idx)
- if type(idx) == 'number' then
- vim.cmd('normal! ' .. idx .. 'z=')
- end
-end)
+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
end
local cword = vim.fn.expand('<cword>')
- local prompt = 'Change ' .. vim.inspect(cword) .. ' to:'
+ 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' })