1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
}
|