@@ -7,36 +7,60 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
7
7
vim .cmd [[ packadd packer.nvim]]
8
8
end
9
9
10
- -- stylua: ignore start
11
10
require (' 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
28
53
29
54
-- Fuzzy Finder (files, lsp, etc)
30
55
use { ' nvim-telescope/telescope.nvim' , branch = ' 0.1.x' , requires = { ' nvim-lua/plenary.nvim' } }
31
56
32
57
-- 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 }
34
59
35
60
if is_bootstrap then
36
61
require (' packer' ).sync ()
37
62
end
38
63
end )
39
- -- stylua: ignore end
40
64
41
65
-- When we are bootstrapping a configuration, it doesn't
42
66
-- make sense to execute the rest of the init.lua.
@@ -197,7 +221,6 @@ require('nvim-treesitter.configs').setup {
197
221
keymaps = {
198
222
init_selection = ' <c-space>' ,
199
223
node_incremental = ' <c-space>' ,
200
- -- TODO: I'm not sure for this one.
201
224
scope_incremental = ' <c-s>' ,
202
225
node_decremental = ' <c-backspace>' ,
203
226
},
@@ -274,7 +297,7 @@ local on_attach = function(_, bufnr)
274
297
275
298
nmap (' gd' , vim .lsp .buf .definition , ' [G]oto [D]efinition' )
276
299
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 ' )
278
301
nmap (' <leader>ds' , require (' telescope.builtin' ).lsp_document_symbols , ' [D]ocument [S]ymbols' )
279
302
nmap (' <leader>ws' , require (' telescope.builtin' ).lsp_dynamic_workspace_symbols , ' [W]orkspace [S]ymbols' )
280
303
@@ -301,27 +324,32 @@ local on_attach = function(_, bufnr)
301
324
end , { desc = ' Format current buffer with LSP' })
302
325
end
303
326
304
- -- nvim-cmp supports additional completion capabilities
305
- local capabilities = require (' cmp_nvim_lsp' ).default_capabilities (vim .lsp .protocol .make_client_capabilities ())
306
-
307
327
-- Setup mason so it can manage external tooling
308
328
require (' mason' ).setup ()
309
329
310
330
-- 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' }
312
333
313
334
-- Ensure the servers above are installed
314
335
require (' mason-lspconfig' ).setup {
315
336
ensure_installed = servers ,
316
337
}
317
338
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
+
318
343
for _ , lsp in ipairs (servers ) do
319
344
require (' lspconfig' )[lsp ].setup {
320
345
on_attach = on_attach ,
321
346
capabilities = capabilities ,
322
347
}
323
348
end
324
349
350
+ -- Turn on status information
351
+ require (' fidget' ).setup ()
352
+
325
353
-- Example custom configuration for lua
326
354
--
327
355
-- Make runtime files discoverable to the server
0 commit comments