updated lsp config

This commit is contained in:
Saeed Afzal
2023-04-29 16:17:55 +01:00
parent 86cc9b52ec
commit 1d3df81f8f
6 changed files with 196 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = "BufEnter",
opts = {
char = "",
context_char = "",

55
lua/plugins/cmp.lua Normal file
View File

@@ -0,0 +1,55 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua"
},
event = { "InsertEnter", "CmdlineEnter" },
config = function()
local cmp = require("cmp")
cmp.setup {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item()
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" }
}, {
{ name = "buffer" },
{ name = "path" }
})
}
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = { name = "buffer" }
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" }
}, {
{ name = "cmdline" }
})
})
end
}

View File

@@ -6,7 +6,6 @@ return {
{
"numToStr/Comment.nvim",
event = "BufEnter",
config = true
},
@@ -20,8 +19,7 @@ return {
{
"andymass/vim-matchup",
dependencies = "nvim-treesitter/nvim-treesitter",
event = "BufEnter"
dependencies = "nvim-treesitter/nvim-treesitter"
},
{
@@ -51,5 +49,107 @@ return {
dependencies = "nvim-lua/plenary.nvim",
cmd = "DiffviewOpen",
config = true
},
-- NOTE: LSP
{
"neovim/nvim-lspconfig",
lazy = true,
dependencies = {
{ "folke/neodev.nvim", opts = { experimental = { pathStrict = true } } },
"williamboman/mason-lspconfig.nvim"
}
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = "williamboman/mason.nvim",
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local handlers = {
function (server_name)
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
end
}
require("mason-lspconfig").setup { handlers = handlers }
end
},
{
"williamboman/mason.nvim",
build = ":MasonUpdate",
config = true
},
{
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end
}
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
},
"RRethy/vim-illuminate",
{
"ray-x/lsp_signature.nvim",
dependencies = "neovim/nvim-lspconfig",
config = true
},
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
config = true
},
{
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
cmd = "TroubleToggle",
config = true
},
{
"weilbith/nvim-code-action-menu",
dependencies = "neovim/nvim-lspconfig",
cmd = "CodeActionMenu"
},
{
"CosmicNvim/cosmic-ui",
lazy = true,
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim"
},
config = true
},
{
"rcarriga/nvim-dap-ui",
lazy = true,
dependencies = "mfussenegger/nvim-dap",
config = true
},
{
"leoluz/nvim-dap-go",
lazy = true,
dependencies = "mfussenegger/nvim-dap",
config = true
}
}

View File

@@ -6,7 +6,17 @@ return {
"MunifTanjim/nui.nvim"
},
cmd = "Neotree",
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
init = function()
vim.g.neo_tree_remove_legacy_commands = true
vim.fn.sign_define("DiagnosticSignError",
{text = "", texthl = "DiagnosticSignError"})
vim.fn.sign_define("DiagnosticSignWarn",
{text = "", texthl = "DiagnosticSignWarn"})
vim.fn.sign_define("DiagnosticSignInfo",
{text = "", texthl = "DiagnosticSignInfo"})
vim.fn.sign_define("DiagnosticSignHint",
{text = "", texthl = "DiagnosticSignHint"})
end,
opts = {
close_if_last_window = true,

View File

@@ -1,6 +1,9 @@
return {
"nvim-treesitter/nvim-treesitter",
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
dependencies = {
"windwp/nvim-ts-autotag",
"JoosepAlviste/nvim-ts-context-commentstring"
},
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup {