commit 1dfffa49a429c0075787b3b49ddffab179bef13a
parent b1ce67f45422854d5351d2a308f7d8fae31c6fd1
Author: Michal Sapka <michal@sapka.me>
Date: Sat, 21 May 2022 19:32:35 +0200
Add LSP config
Diffstat:
2 files changed, 118 insertions(+), 6 deletions(-)
diff --git a/nvim/init.lua b/nvim/init.lua
@@ -118,8 +118,8 @@ local kind_icons = {
Operator = "",
TypeParameter = "",
}
+--
-- find more here: https://www.nerdfonts.com/cheat-sheet
-
cmp.setup {
snippet = {
expand = function(args)
@@ -176,14 +176,16 @@ cmp.setup {
-- vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
vim_item.kind = string.format('%s', vim_item.kind) -- This concatonates the icons with the name of the item kind
vim_item.menu = ({
- luasnip = "[S]",
- buffer = "[B]",
- path = "[P]",
+ luasnip = "[Snip]",
+ nvim_lsp = "[LSP]",
+ buffer = "[Buff]",
+ path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
sources = {
+ { name = 'nvim_lsp' },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
@@ -198,9 +200,18 @@ cmp.setup {
},
}
+-- LSP
+require("nvim-lsp-installer").setup {}
+--
+-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
+-- The following example advertise capabilities to `clangd`.
+require'lspconfig'.clangd.setup {
+ capabilities = capabilities,
+}
-- Install your plugins here
-
return packer.startup(function(use)
-- My plugins here
use "wbthomason/packer.nvim" -- Have packer manage itself
@@ -226,18 +237,29 @@ return packer.startup(function(use)
requires = { {'nvim-lua/plenary.nvim'} }
}
vim.cmd('colorscheme dracula')
-
+
-- cmp
use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-buffer"
use "hrsh7th/cmp-path"
use "hrsh7th/cmp-cmdline"
use "saadparwaiz1/cmp_luasnip"
+ use "hrsh7th/cmp-nvim-lsp"
--snippets
use "L3MON4D3/LuaSnip"
use "rafamadriz/friendly-snippets"
+ use "williamboman/nvim-lsp-installer"
+ use {
+ 'neovim/nvim-lspconfig',
+ config = function()
+ require("nvim-lsp-installer").setup {}
+ local lspconfig = require("lspconfig")
+ lspconfig.sumneko_lua.setup {}
+ end
+ }
+
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if PACKER_BOOTSTRAP then
diff --git a/nvim/plugin/packer_compiled.lua b/nvim/plugin/packer_compiled.lua
@@ -69,6 +69,83 @@ end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
+ LuaSnip = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/LuaSnip",
+ url = "https://github.com/L3MON4D3/LuaSnip"
+ },
+ ["cmp-buffer"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/cmp-buffer",
+ url = "https://github.com/hrsh7th/cmp-buffer"
+ },
+ ["cmp-cmdline"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
+ url = "https://github.com/hrsh7th/cmp-cmdline"
+ },
+ ["cmp-nvim-lsp"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
+ url = "https://github.com/hrsh7th/cmp-nvim-lsp"
+ },
+ ["cmp-path"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/cmp-path",
+ url = "https://github.com/hrsh7th/cmp-path"
+ },
+ cmp_luasnip = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
+ url = "https://github.com/saadparwaiz1/cmp_luasnip"
+ },
+ ["dracula.nvim"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/dracula.nvim",
+ url = "https://github.com/Mofiqul/dracula.nvim"
+ },
+ ["friendly-snippets"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/friendly-snippets",
+ url = "https://github.com/rafamadriz/friendly-snippets"
+ },
+ ["gitsigns.nvim"] = {
+ config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" },
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
+ url = "https://github.com/lewis6991/gitsigns.nvim"
+ },
+ ["lualine.nvim"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/lualine.nvim",
+ url = "https://github.com/nvim-lualine/lualine.nvim"
+ },
+ ["nvim-cmp"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/nvim-cmp",
+ url = "https://github.com/hrsh7th/nvim-cmp"
+ },
+ ["nvim-lsp-installer"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
+ url = "https://github.com/williamboman/nvim-lsp-installer"
+ },
+ ["nvim-lspconfig"] = {
+ config = { "\27LJ\2\nv\0\0\4\0\5\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\0016\0\0\0'\2\3\0B\0\2\0029\1\4\0009\1\2\0014\3\0\0B\1\2\1K\0\1\0\16sumneko_lua\14lspconfig\nsetup\23nvim-lsp-installer\frequire\0" },
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
+ url = "https://github.com/neovim/nvim-lspconfig"
+ },
+ ["nvim-tree.lua"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
+ url = "https://github.com/kyazdani42/nvim-tree.lua"
+ },
+ ["nvim-web-devicons"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
+ url = "https://github.com/kyazdani42/nvim-web-devicons"
+ },
["packer.nvim"] = {
loaded = true,
path = "/home/msapka/.local/share/nvim/site/pack/packer/start/packer.nvim",
@@ -83,10 +160,23 @@ _G.packer_plugins = {
loaded = true,
path = "/home/msapka/.local/share/nvim/site/pack/packer/start/popup.nvim",
url = "https://github.com/nvim-lua/popup.nvim"
+ },
+ ["telescope.nvim"] = {
+ loaded = true,
+ path = "/home/msapka/.local/share/nvim/site/pack/packer/start/telescope.nvim",
+ url = "https://github.com/nvim-telescope/telescope.nvim"
}
}
time([[Defining packer_plugins]], false)
+-- Config for: nvim-lspconfig
+time([[Config for nvim-lspconfig]], true)
+try_loadstring("\27LJ\2\nv\0\0\4\0\5\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\0016\0\0\0'\2\3\0B\0\2\0029\1\4\0009\1\2\0014\3\0\0B\1\2\1K\0\1\0\16sumneko_lua\14lspconfig\nsetup\23nvim-lsp-installer\frequire\0", "config", "nvim-lspconfig")
+time([[Config for nvim-lspconfig]], false)
+-- Config for: gitsigns.nvim
+time([[Config for gitsigns.nvim]], true)
+try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim")
+time([[Config for gitsigns.nvim]], false)
if should_profile then save_profiles() end
end)