@@ -7,36 +7,60 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
77 vim .cmd [[ packadd packer.nvim]]
88end
99
10- -- stylua: ignore start
1110require (' packer' ).startup (function (use )
12- use ' wbthomason/packer.nvim' -- Package manager
13- use ' tpope/vim-fugitive' -- Git commands in nvim
14- use ' tpope/vim-rhubarb' -- Fugitive-companion to interact with github
15- use { ' lewis6991/gitsigns.nvim' , requires = { ' nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups
16- use ' numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
17- use ' nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code
18- use { ' nvim-treesitter/nvim-treesitter-textobjects' , after = { ' nvim-treesitter' } } -- Additional textobjects for treesitter
19- use ' neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client
20- use ' williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers
21- use ' williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath
22- use { ' hrsh7th/nvim-cmp' , requires = { ' hrsh7th/cmp-nvim-lsp' } } -- Autocompletion
23- use { ' L3MON4D3/LuaSnip' , requires = { ' saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion
24- use ' navarasu/onedark.nvim' -- Theme inspired by Atom
25- use ' nvim-lualine/lualine.nvim' -- Fancier statusline
26- use ' lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
27- use ' tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
11+ -- Package manager
12+ use ' wbthomason/packer.nvim'
13+
14+ use { -- LSP Configuration & Plugins
15+ ' neovim/nvim-lspconfig' ,
16+ requires = {
17+ -- Automatically install LSPs to stdpath for neovim
18+ ' williamboman/mason.nvim' ,
19+ ' williamboman/mason-lspconfig.nvim' ,
20+
21+ -- Useful status updates for LSP
22+ ' j-hui/fidget.nvim' ,
23+ },
24+ }
25+
26+ use { -- Autocompletion
27+ ' hrsh7th/nvim-cmp' ,
28+ requires = { ' hrsh7th/cmp-nvim-lsp' , ' L3MON4D3/LuaSnip' , ' saadparwaiz1/cmp_luasnip' },
29+ }
30+
31+ use { -- Highlight, edit, and navigate code
32+ ' nvim-treesitter/nvim-treesitter' ,
33+ run = function ()
34+ pcall (require (' nvim-treesitter.install' ).update { with_sync = true })
35+ end ,
36+ }
37+
38+ use { -- Additional text objects via treesitter
39+ ' nvim-treesitter/nvim-treesitter-textobjects' ,
40+ after = ' nvim-treesitter' ,
41+ }
42+
43+ -- Git related plugins
44+ use ' tpope/vim-fugitive'
45+ use ' tpope/vim-rhubarb'
46+ use ' lewis6991/gitsigns.nvim'
47+
48+ use ' navarasu/onedark.nvim' -- Theme inspired by Atom
49+ use ' nvim-lualine/lualine.nvim' -- Fancier statusline
50+ use ' lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
51+ use ' numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
52+ use ' tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
2853
2954 -- Fuzzy Finder (files, lsp, etc)
3055 use { ' nvim-telescope/telescope.nvim' , branch = ' 0.1.x' , requires = { ' nvim-lua/plenary.nvim' } }
3156
3257 -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
33- use { ' nvim-telescope/telescope-fzf-native.nvim' , run = ' make' , cond = vim .fn .executable " make" == 1 }
58+ use { ' nvim-telescope/telescope-fzf-native.nvim' , run = ' make' , cond = vim .fn .executable ' make' == 1 }
3459
3560 if is_bootstrap then
3661 require (' packer' ).sync ()
3762 end
3863end )
39- -- stylua: ignore end
4064
4165-- When we are bootstrapping a configuration, it doesn't
4266-- make sense to execute the rest of the init.lua.
@@ -197,7 +221,6 @@ require('nvim-treesitter.configs').setup {
197221 keymaps = {
198222 init_selection = ' <c-space>' ,
199223 node_incremental = ' <c-space>' ,
200- -- TODO: I'm not sure for this one.
201224 scope_incremental = ' <c-s>' ,
202225 node_decremental = ' <c-backspace>' ,
203226 },
@@ -274,7 +297,7 @@ local on_attach = function(_, bufnr)
274297
275298 nmap (' gd' , vim .lsp .buf .definition , ' [G]oto [D]efinition' )
276299 nmap (' gi' , vim .lsp .buf .implementation , ' [G]oto [I]mplementation' )
277- nmap (' gr' , require (' telescope.builtin' ).lsp_references )
300+ nmap (' gr' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences ' )
278301 nmap (' <leader>ds' , require (' telescope.builtin' ).lsp_document_symbols , ' [D]ocument [S]ymbols' )
279302 nmap (' <leader>ws' , require (' telescope.builtin' ).lsp_dynamic_workspace_symbols , ' [W]orkspace [S]ymbols' )
280303
@@ -301,27 +324,32 @@ local on_attach = function(_, bufnr)
301324 end , { desc = ' Format current buffer with LSP' })
302325end
303326
304- -- nvim-cmp supports additional completion capabilities
305- local capabilities = require (' cmp_nvim_lsp' ).default_capabilities (vim .lsp .protocol .make_client_capabilities ())
306-
307327-- Setup mason so it can manage external tooling
308328require (' mason' ).setup ()
309329
310330-- Enable the following language servers
311- local servers = { ' clangd' , ' rust_analyzer' , ' pyright' , ' tsserver' , ' sumneko_lua' }
331+ -- Feel free to add/remove any LSPs that you want here. They will automatically be installed
332+ local servers = { ' clangd' , ' rust_analyzer' , ' pyright' , ' tsserver' , ' sumneko_lua' , ' gopls' }
312333
313334-- Ensure the servers above are installed
314335require (' mason-lspconfig' ).setup {
315336 ensure_installed = servers ,
316337}
317338
339+ -- nvim-cmp supports additional completion capabilities
340+ local capabilities = vim .lsp .protocol .make_client_capabilities ()
341+ capabilities = require (' cmp_nvim_lsp' ).default_capabilities (capabilities )
342+
318343for _ , lsp in ipairs (servers ) do
319344 require (' lspconfig' )[lsp ].setup {
320345 on_attach = on_attach ,
321346 capabilities = capabilities ,
322347 }
323348end
324349
350+ -- Turn on status information
351+ require (' fidget' ).setup ()
352+
325353-- Example custom configuration for lua
326354--
327355-- Make runtime files discoverable to the server
0 commit comments