diff options
| author | triethyl <triethylammonium@pm.me> | 2025-11-05 20:38:53 -0500 |
|---|---|---|
| committer | triethyl <triethylammonium@pm.me> | 2025-11-05 20:38:53 -0500 |
| commit | 0a7aa13d9e8a0e526353c6538d8cf2d365ade86b (patch) | |
| tree | a320387bd5bd408f863ffc476e5ab18b90b175a0 /pkgs/custom-neovim/config/lua/plugins/mini-completion.lua | |
| parent | 56b150edeacbe30f1e19e5a7df03499c5dced06d (diff) | |
neovim: lots of new mini plugins and configs
Diffstat (limited to 'pkgs/custom-neovim/config/lua/plugins/mini-completion.lua')
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/mini-completion.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-completion.lua b/pkgs/custom-neovim/config/lua/plugins/mini-completion.lua new file mode 100644 index 0000000..7cc0fa6 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/mini-completion.lua @@ -0,0 +1,39 @@ +return { + "mini.completion", + enabled = true, + lazy = true, + event = "InsertEnter", + after = function() + require("mini.completion").setup { + window = { + info = { + border = "rounded", + }, + signature = { + border = "rounded", + }, + }, + } + local imap_expr = function(lhs, rhs) + vim.keymap.set('i', lhs, rhs, { expr = true }) + end + imap_expr('<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]]) + imap_expr('<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]]) + + -- Disable arrow keys from navigating completion window. + -- I like to navigate inside insert mode and the window prevents that. + + vim.keymap.set('i', '<Up>', function() + -- cancel completion popup + vim.fn.complete(vim.fn.col('.'), {}) + + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Up>', true, false, true), 'n', true) + end, { noremap = true, desc = 'Cancel completion and move cursor up' }) + + vim.keymap.set('i', '<Down>', function() + vim.fn.complete(vim.fn.col('.'), {}) + + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Down>', true, false, true), 'n', true) + end, { noremap = true, desc = 'Cancel completion and move cursor down' }) + end +} |
