|
|
@ -7,36 +7,60 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
|
|
|
vim.cmd [[packadd packer.nvim]]
|
|
|
|
vim.cmd [[packadd packer.nvim]]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- stylua: ignore start
|
|
|
|
|
|
|
|
require('packer').startup(function(use)
|
|
|
|
require('packer').startup(function(use)
|
|
|
|
use 'wbthomason/packer.nvim' -- Package manager
|
|
|
|
-- Package manager
|
|
|
|
use 'tpope/vim-fugitive' -- Git commands in nvim
|
|
|
|
use 'wbthomason/packer.nvim'
|
|
|
|
use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github
|
|
|
|
|
|
|
|
use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups
|
|
|
|
use { -- LSP Configuration & Plugins
|
|
|
|
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code
|
|
|
|
requires = {
|
|
|
|
use { 'nvim-treesitter/nvim-treesitter-textobjects', after = { 'nvim-treesitter' } } -- Additional textobjects for treesitter
|
|
|
|
-- Automatically install LSPs to stdpath for neovim
|
|
|
|
use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client
|
|
|
|
'williamboman/mason.nvim',
|
|
|
|
use 'williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath
|
|
|
|
|
|
|
|
use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion
|
|
|
|
-- Useful status updates for LSP
|
|
|
|
use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion
|
|
|
|
'j-hui/fidget.nvim',
|
|
|
|
use 'navarasu/onedark.nvim' -- Theme inspired by Atom
|
|
|
|
},
|
|
|
|
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
|
|
|
|
}
|
|
|
|
use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
|
|
|
|
|
|
|
|
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
|
|
|
|
use { -- Autocompletion
|
|
|
|
|
|
|
|
'hrsh7th/nvim-cmp',
|
|
|
|
|
|
|
|
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use { -- Highlight, edit, and navigate code
|
|
|
|
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
|
|
|
|
run = function()
|
|
|
|
|
|
|
|
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use { -- Additional text objects via treesitter
|
|
|
|
|
|
|
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
|
|
|
|
|
|
|
after = 'nvim-treesitter',
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Git related plugins
|
|
|
|
|
|
|
|
use 'tpope/vim-fugitive'
|
|
|
|
|
|
|
|
use 'tpope/vim-rhubarb'
|
|
|
|
|
|
|
|
use 'lewis6991/gitsigns.nvim'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use 'navarasu/onedark.nvim' -- Theme inspired by Atom
|
|
|
|
|
|
|
|
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
|
|
|
|
|
|
|
|
use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
|
|
|
|
|
|
|
|
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
|
|
|
|
|
|
|
|
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
|
|
|
|
|
|
|
|
|
|
|
|
-- Fuzzy Finder (files, lsp, etc)
|
|
|
|
-- Fuzzy Finder (files, lsp, etc)
|
|
|
|
use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
|
|
|
|
use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
|
|
|
|
|
|
|
|
|
|
|
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
|
|
|
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
|
|
|
|
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable "make" == 1 }
|
|
|
|
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 }
|
|
|
|
|
|
|
|
|
|
|
|
if is_bootstrap then
|
|
|
|
if is_bootstrap then
|
|
|
|
require('packer').sync()
|
|
|
|
require('packer').sync()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
-- stylua: ignore end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- When we are bootstrapping a configuration, it doesn't
|
|
|
|
-- When we are bootstrapping a configuration, it doesn't
|
|
|
|
-- make sense to execute the rest of the init.lua.
|
|
|
|
-- make sense to execute the rest of the init.lua.
|
|
|
@ -197,7 +221,6 @@ require('nvim-treesitter.configs').setup {
|
|
|
|
keymaps = {
|
|
|
|
keymaps = {
|
|
|
|
init_selection = '<c-space>',
|
|
|
|
init_selection = '<c-space>',
|
|
|
|
node_incremental = '<c-space>',
|
|
|
|
node_incremental = '<c-space>',
|
|
|
|
-- TODO: I'm not sure for this one.
|
|
|
|
|
|
|
|
scope_incremental = '<c-s>',
|
|
|
|
scope_incremental = '<c-s>',
|
|
|
|
node_decremental = '<c-backspace>',
|
|
|
|
node_decremental = '<c-backspace>',
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -274,7 +297,7 @@ local on_attach = function(_, bufnr)
|
|
|
|
|
|
|
|
|
|
|
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
|
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
|
|
nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
|
|
|
nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
|
|
|
nmap('gr', require('telescope.builtin').lsp_references)
|
|
|
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
|
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
|
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
|
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
|
|
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
|
|
|
|
|
|
|
|
|
|
@ -301,20 +324,22 @@ local on_attach = function(_, bufnr)
|
|
|
|
end, { desc = 'Format current buffer with LSP' })
|
|
|
|
end, { desc = 'Format current buffer with LSP' })
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- nvim-cmp supports additional completion capabilities
|
|
|
|
|
|
|
|
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Setup mason so it can manage external tooling
|
|
|
|
-- Setup mason so it can manage external tooling
|
|
|
|
require('mason').setup()
|
|
|
|
require('mason').setup()
|
|
|
|
|
|
|
|
|
|
|
|
-- Enable the following language servers
|
|
|
|
-- Enable the following language servers
|
|
|
|
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua' }
|
|
|
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed
|
|
|
|
|
|
|
|
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' }
|
|
|
|
|
|
|
|
|
|
|
|
-- Ensure the servers above are installed
|
|
|
|
-- Ensure the servers above are installed
|
|
|
|
require('mason-lspconfig').setup {
|
|
|
|
require('mason-lspconfig').setup {
|
|
|
|
ensure_installed = servers,
|
|
|
|
ensure_installed = servers,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- nvim-cmp supports additional completion capabilities
|
|
|
|
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
|
|
|
|
|
|
|
|
|
|
for _, lsp in ipairs(servers) do
|
|
|
|
for _, lsp in ipairs(servers) do
|
|
|
|
require('lspconfig')[lsp].setup {
|
|
|
|
require('lspconfig')[lsp].setup {
|
|
|
|
on_attach = on_attach,
|
|
|
|
on_attach = on_attach,
|
|
|
@ -322,6 +347,9 @@ for _, lsp in ipairs(servers) do
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Turn on status information
|
|
|
|
|
|
|
|
require('fidget').setup()
|
|
|
|
|
|
|
|
|
|
|
|
-- Example custom configuration for lua
|
|
|
|
-- Example custom configuration for lua
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- Make runtime files discoverable to the server
|
|
|
|
-- Make runtime files discoverable to the server
|
|
|
|