modified nvim config

This commit is contained in:
2024-03-24 19:16:38 +00:00
parent 0640186313
commit 9ffc5b6d98
4 changed files with 49 additions and 27 deletions

View File

@@ -36,7 +36,7 @@ return {
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
}
end,
["lua_ls"] = function()
@@ -65,30 +65,53 @@ return {
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({
-- completion = { autocomplete = true },
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<Down>'] = cmp.mapping.select_next_item(cmp_select),
['<Up>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-j>'] = cmp.mapping.select_next_item(cmp_select),
['<C-k>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
['<C-Space>'] = cmp.mapping.complete({
config = {
sources = {
{ name = 'luasnip' }
}
}
}),
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
--['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<CR>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
})
{ name = 'buffer' },
}),
})
vim.diagnostic.config({
-- update_in_insert = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = '',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.INFO] = '󰋼',
[vim.diagnostic.severity.HINT] = '',
}
},
update_in_insert = true,
float = {
focusable = false,
focusable = true,
style = "minimal",
border = "rounded",
source = "always",

View File

@@ -100,7 +100,6 @@ return {
},
{
'diagnostics',
},
-- {
-- 'filetype',

View File

@@ -18,7 +18,7 @@ vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("XDG_CONFIG_HOME") .. "/.vim/undodir"
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false