Last active
October 27, 2024 14:32
-
-
Save m-pilia/2273f1c53bea11f201985e835706d810 to your computer and use it in GitHub Desktop.
Neovim 0.11 built-in LSP autocompletion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Built-in autocompletion | |
local lsp_au_group = vim.api.nvim_create_augroup('lsp_au_group', {clear = true}) | |
vim.api.nvim_create_autocmd({'LspAttach'}, { | |
callback = function() | |
local clients = vim.lsp.get_clients() | |
for _, client in ipairs(clients) do | |
local id = client.id | |
vim.lsp.completion.enable(true, id, 0, {autotrigger = true}) | |
end | |
end, | |
group = lsp_au_group, | |
}) | |
require("nvim-autopairs").setup { | |
map_bs = false, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inoremap <silent> <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>" | |
inoremap <silent> <expr> <S-tab> pumvisible() ? "\<C-p>" : "\<S-tab>" | |
inoremap <silent> <C-space> <C-x><C-o> | |
inoremap <silent> <expr> <C-j> pumvisible() ? "\<C-y>" : "\<C-j>" | |
inoremap <silent> <expr> <bs> pumvisible() ? "\<bs>\<c-x>\<c-o>" | |
\ : v:lua.require('nvim-autopairs').autopairs_bs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment