refactor(nvim): update completion behavior and map Tab for selection
- Update `completeopt` to `noinsert` to prevent automatic suggestion injection. - Add `<Tab>` keymap to accept completion selections when the popup menu is visible.
This commit is contained in:
1 parent
e083be3110
commit
3496a05674
1 file changed
+11
-1
@@ -6,4 +6,14 @@ vim.opt.expandtab = true -- Convert tabs to spaces
|
|||||||
vim.opt.smartindent = true -- Intelligent auto-indenting based on file syntax
|
vim.opt.smartindent = true -- Intelligent auto-indenting based on file syntax
|
||||||
vim.opt.wrap = false -- Disable automatic line wrapping
|
vim.opt.wrap = false -- Disable automatic line wrapping
|
||||||
vim.opt.termguicolors = true -- Enable 24-bit RGB terminal colors
|
vim.opt.termguicolors = true -- Enable 24-bit RGB terminal colors
|
||||||
vim.opt.completeopt = { "menu", "menuone", "noselect" } -- Smooth auto-completion behavior
|
vim.opt.completeopt = { "menu", "menuone", "noinsert" } -- Smooth auto-completion behavior
|
||||||
|
|
||||||
|
-- Accept completion with Tab when the completion menu is visible
|
||||||
|
vim.keymap.set('i', '<Tab>', function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return '<C-y>'
|
||||||
|
else
|
||||||
|
return '<Tab>'
|
||||||
|
end
|
||||||
|
end, { expr = true, silent = true })
|
||||||
|
|
||||||
Reference in new issue
Block a user