nvim: fix tab completion

This commit is contained in:
surtur 2023-08-10 18:15:54 +02:00
parent dcdac91726
commit 785aae79c8
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -526,6 +526,11 @@ vim.api.nvim_create_autocmd('LspAttach', {
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
local complopts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
vim.keymap.set("i", "<TAB>", [[pumvisible() ? "\<c-n>" : "\<TAB>"]], complopts)
vim.keymap.set("i", "<S-TAB>", [[pumvisible() ? "\<c-p>" : "\<C-h>"]], complopts)
vim.keymap.set("i", "<cr>", [[pumvisible() ? "\<c-y>" : "\<cr>"]], complopts)
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }