native autocompletion & fixes
This commit is contained in:
parent
5b44802b68
commit
8b32f22c49
@ -5,6 +5,6 @@
|
||||
vim.opt.laststatus = 3
|
||||
vim.g.maplocalleader = ","
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
vim.opt.completeopt = { "menuone", "noselect", "popup" }
|
||||
vim.opt.completeopt = { "menu", "menuone", "noinsert", "noselect", "popup" }
|
||||
|
||||
vim.opt.scrolloff = 20
|
||||
|
||||
@ -71,6 +71,22 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
|
||||
if client:supports_method("textDocument/completion") then
|
||||
client.server_capabilities.completionProvider.triggerCharacters = vim.tbl_keys(
|
||||
vim.tbl_extend(
|
||||
"force",
|
||||
vim.iter(client.server_capabilities.completionProvider.triggerCharacters or {}):fold({}, function(chars, char)
|
||||
chars[char] = true
|
||||
return chars
|
||||
end),
|
||||
vim
|
||||
.iter(vim.split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-", ""))
|
||||
:fold({}, function(chars, char)
|
||||
chars[char] = true
|
||||
return chars
|
||||
end)
|
||||
)
|
||||
)
|
||||
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||
end
|
||||
|
||||
@ -183,6 +199,7 @@ vim.api.nvim_create_autocmd({ "LspAttach", "BufEnter" }, {
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set("i", "<M-Space>", function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-e>", true, false, true), "n", false)
|
||||
|
||||
@ -90,6 +90,14 @@ return {
|
||||
-- indent = { enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
opts = {
|
||||
popupmenu = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/zen-mode.nvim",
|
||||
keys = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user