From e311d48c97f00d526b266c9d67c4a120eba622f7 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 18 Nov 2022 21:04:04 -0500 Subject: [PATCH] reformat to reduce merge conflicts and add fidget --- .gitignore | 1 + init.lua | 78 +++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 6e92f57d..712f217f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ tags +test.sh diff --git a/init.lua b/init.lua index 9b085bff..5ed766c4 100644 --- a/init.lua +++ b/init.lua @@ -7,36 +7,60 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd [[packadd packer.nvim]] end --- stylua: ignore start require('packer').startup(function(use) - use 'wbthomason/packer.nvim' -- Package manager - use 'tpope/vim-fugitive' -- Git commands in 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 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines - use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code - use { 'nvim-treesitter/nvim-treesitter-textobjects', after = { 'nvim-treesitter' } } -- Additional textobjects for treesitter - use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use 'williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers - use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath - use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion - use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion - 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 + -- Package manager + use 'wbthomason/packer.nvim' + + use { -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + requires = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + 'j-hui/fidget.nvim', + }, + } + + 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) 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 - 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 require('packer').sync() end end) --- stylua: ignore end -- When we are bootstrapping a configuration, it doesn't -- make sense to execute the rest of the init.lua. @@ -197,7 +221,6 @@ require('nvim-treesitter.configs').setup { keymaps = { init_selection = '', node_incremental = '', - -- TODO: I'm not sure for this one. scope_incremental = '', node_decremental = '', }, @@ -274,7 +297,7 @@ local on_attach = function(_, bufnr) nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') 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('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('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 --- 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 require('mason').setup() -- 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 require('mason-lspconfig').setup { 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 require('lspconfig')[lsp].setup { on_attach = on_attach, @@ -322,6 +347,9 @@ for _, lsp in ipairs(servers) do } end +-- Turn on status information +require('fidget').setup() + -- Example custom configuration for lua -- -- Make runtime files discoverable to the server