From 11e1d6080429177c7e0aafc1e9dcb8f800ef4ea4 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 19 Nov 2024 13:16:10 -0600 Subject: turn fancy spell suggest ui into a lambda, and fix some styling --- lua/conf/binds.lua | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lua') 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', ']]', 'tabn') -- 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('') - 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' }) -- cgit v1.2.1