revamped nvim config with lsp.zero
This commit is contained in:
parent
b32fa96788
commit
1f2f336b64
9 changed files with 283 additions and 350 deletions
|
|
@ -1,18 +1,12 @@
|
|||
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
local is_bootstrap = false
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
is_bootstrap = true
|
||||
vim.fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
require("packer").startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
use("folke/tokyonight.nvim")
|
||||
|
|
@ -35,21 +29,29 @@ return require("packer").startup(function(use)
|
|||
ts_update()
|
||||
end,
|
||||
})
|
||||
use({ "williamboman/mason.nvim" })
|
||||
use({ "williamboman/mason-lspconfig.nvim" })
|
||||
|
||||
-- configure lsp servers
|
||||
use("neovim/nvim-lspconfig")
|
||||
use("hrsh7th/cmp-nvim-lsp")
|
||||
use("hrsh7th/cmp-buffer")
|
||||
use("hrsh7th/nvim-cmp")
|
||||
-- use("tzachar/cmp-tabnine", { run = "./install.sh" })
|
||||
use("onsails/lspkind-nvim")
|
||||
use("nvim-lua/lsp_extensions.nvim")
|
||||
use("glepnir/lspsaga.nvim")
|
||||
use("simrat39/symbols-outline.nvim")
|
||||
use("L3MON4D3/LuaSnip")
|
||||
use("saadparwaiz1/cmp_luasnip")
|
||||
-- LSP
|
||||
use({
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
requires = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
|
||||
-- Snippets
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
})
|
||||
|
||||
-- formatting & linting
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
|
|
@ -92,9 +94,32 @@ return require("packer").startup(function(use)
|
|||
end,
|
||||
})
|
||||
|
||||
use("theprimeagen/harpoon")
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
if is_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
||||
-- When we are bootstrapping a configuration, it doesn't
|
||||
-- make sense to execute the rest of the init.lua.
|
||||
--
|
||||
-- You'll need to restart nvim, and then it will work.
|
||||
if is_bootstrap then
|
||||
print("==================================")
|
||||
print(" Plugins are being installed")
|
||||
print(" Wait until Packer completes,")
|
||||
print(" then restart nvim")
|
||||
print("==================================")
|
||||
return
|
||||
end
|
||||
|
||||
-- Automatically source and re-compile packer whenever you save this init.lua
|
||||
local packer_group = vim.api.nvim_create_augroup("Packer", { clear = true })
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
command = "source <afile> | silent! LspStop | silent! LspStart | PackerCompile",
|
||||
group = packer_group,
|
||||
pattern = vim.fn.expand("$MYVIMRC"),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue