From c8cc9c3f39b1b739aeeeaf832af16cf8688d2abd Mon Sep 17 00:00:00 2001 From: Tom Conley Date: Sun, 4 Aug 2024 09:17:40 -0700 Subject: [PATCH 01/15] Add ruby_lsp to language servers --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 220d3045268..c95ae0c1137 100644 --- a/init.lua +++ b/init.lua @@ -569,6 +569,7 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { + ruby_lsp = {}, -- clangd = {}, -- gopls = {}, -- pyright = {}, From 663b8ac79f87d137d7baf780175ce84dbe0d15b7 Mon Sep 17 00:00:00 2001 From: Tom Conley Date: Sun, 4 Aug 2024 09:20:17 -0700 Subject: [PATCH 02/15] Add ripgrep dependency --- doc/dependencies.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/dependencies.txt diff --git a/doc/dependencies.txt b/doc/dependencies.txt new file mode 100644 index 00000000000..b23be28c47a --- /dev/null +++ b/doc/dependencies.txt @@ -0,0 +1 @@ +`brew install ripgrep` From 4243ff4f074d03e2b93f1ea591aab49b2ad2c5e5 Mon Sep 17 00:00:00 2001 From: Tom Conley Date: Sun, 4 Aug 2024 10:51:27 -0700 Subject: [PATCH 03/15] Enable nerd font; enable Go LSP --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index c95ae0c1137..90a0f4817d1 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -571,7 +571,7 @@ require('lazy').setup({ local servers = { ruby_lsp = {}, -- clangd = {}, - -- gopls = {}, + gopls = {}, -- pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs From 59e0ea536611dcfe9b3bdae0f236d8b14100fce0 Mon Sep 17 00:00:00 2001 From: Tom Conley Date: Thu, 15 Aug 2024 11:33:36 -0700 Subject: [PATCH 04/15] Use tokyonight-moon color scheme; add barbar --- init.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 90a0f4817d1..2773c9d75db 100644 --- a/init.lua +++ b/init.lua @@ -228,6 +228,23 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ + + -- For view of open buffers + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', + 'nvim-tree/nvim-web-devicones', + }, + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + animation = false, + }, + version = '^1.0.0', + }, + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -794,7 +811,7 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'tokyonight-moon' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' From 22407307c71214dd2cbcef5e6d8d13a7577a57c1 Mon Sep 17 00:00:00 2001 From: Tom Conley Date: Thu, 15 Aug 2024 11:35:21 -0700 Subject: [PATCH 05/15] Relocate barbar --- init.lua | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/init.lua b/init.lua index 2773c9d75db..8c549edd426 100644 --- a/init.lua +++ b/init.lua @@ -228,23 +228,6 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ - - -- For view of open buffers - { - 'romgrk/barbar.nvim', - dependencies = { - 'lewis6991/gitsigns.nvim', - 'nvim-tree/nvim-web-devicones', - }, - init = function() - vim.g.barbar_auto_setup = false - end, - opts = { - animation = false, - }, - version = '^1.0.0', - }, - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -337,6 +320,22 @@ require('lazy').setup({ -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + + -- For view of open buffers + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', + 'nvim-tree/nvim-web-devicones', + }, + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + animation = false, + }, + version = '^1.0.0', + }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that From 721f5d46cbd290cd8cb84d98c5180e4c74eb7bc8 Mon Sep 17 00:00:00 2001 From: Tom Conley Date: Thu, 15 Aug 2024 11:36:11 -0700 Subject: [PATCH 06/15] Fix typo is barbar dependencies --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 8c549edd426..81f1a438253 100644 --- a/init.lua +++ b/init.lua @@ -326,7 +326,7 @@ require('lazy').setup({ 'romgrk/barbar.nvim', dependencies = { 'lewis6991/gitsigns.nvim', - 'nvim-tree/nvim-web-devicones', + 'nvim-tree/nvim-web-devicons', }, init = function() vim.g.barbar_auto_setup = false From 7380e890462dc0b6ab212d3ff6ee316fc718d8d5 Mon Sep 17 00:00:00 2001 From: tommconley Date: Sat, 5 Oct 2024 09:16:56 -0700 Subject: [PATCH 07/15] Add some colorschemes --- init.lua | 58 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index 81f1a438253..58c5813e251 100644 --- a/init.lua +++ b/init.lua @@ -799,21 +799,51 @@ require('lazy').setup({ end, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-moon' + -- { -- You can easily change to a different colorscheme. + -- -- Change the name of the colorscheme plugin below, and then + -- -- change the command in the config to whatever the name of that colorscheme is. + -- -- + -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- Make sure to load this before all the other start plugins. + -- init = function() + -- -- Load the colorscheme here. + -- -- Like many other themes, this one has different styles, and you could load + -- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- vim.cmd.colorscheme 'tokyonight-moon' + -- + -- -- You can configure highlights by doing something like: + -- vim.cmd.hi 'Comment gui=none' + -- end, + -- }, + + -- { + -- 'morhetz/gruvbox', + -- priority = 1000, + -- init = function() + -- vim.g.gruvbox_contrast_dark = 'hard' + -- vim.g.gruvbox_bold = 0 + -- vim.cmd.colorscheme 'gruvbox' + -- end, + -- }, + + -- { + -- 'sainnhe/everforest', + -- priority = 1000, + -- init = function() + -- vim.g.everforest_enable_italic = true + -- vim.g.everforest_background = 'hard' + -- vim.cmd.colorscheme 'everforest' + -- end, + -- }, - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' + { + 'sainnhe/gruvbox-material', + priority = 1000, + init = function() + vim.g.gruvbox_material_enable_italic = true + vim.g.gruvbox_material_background = 'hard' + vim.cmd.colorscheme 'gruvbox-material' end, }, From c4273ee23201a182e391c13774aaa91c4bb60025 Mon Sep 17 00:00:00 2001 From: tommconley Date: Sat, 5 Oct 2024 09:30:13 -0700 Subject: [PATCH 08/15] Switch to everforest --- init.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index 58c5813e251..2ff5d41e966 100644 --- a/init.lua +++ b/init.lua @@ -827,26 +827,26 @@ require('lazy').setup({ -- end, -- }, - -- { - -- 'sainnhe/everforest', - -- priority = 1000, - -- init = function() - -- vim.g.everforest_enable_italic = true - -- vim.g.everforest_background = 'hard' - -- vim.cmd.colorscheme 'everforest' - -- end, - -- }, - { - 'sainnhe/gruvbox-material', + 'sainnhe/everforest', priority = 1000, init = function() - vim.g.gruvbox_material_enable_italic = true - vim.g.gruvbox_material_background = 'hard' - vim.cmd.colorscheme 'gruvbox-material' + vim.g.everforest_enable_italic = true + vim.g.everforest_background = 'hard' + vim.cmd.colorscheme 'everforest' end, }, + -- { + -- 'sainnhe/gruvbox-material', + -- priority = 1000, + -- init = function() + -- vim.g.gruvbox_material_enable_italic = true + -- vim.g.gruvbox_material_background = 'hard' + -- vim.cmd.colorscheme 'gruvbox-material' + -- end, + -- }, + -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, From d82930d87330aeac4a5dcb4211db2eb79e670494 Mon Sep 17 00:00:00 2001 From: tommconley Date: Sat, 5 Oct 2024 09:45:35 -0700 Subject: [PATCH 09/15] Install airline --- init.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/init.lua b/init.lua index 2ff5d41e966..29d1ac26eec 100644 --- a/init.lua +++ b/init.lua @@ -847,6 +847,13 @@ require('lazy').setup({ -- end, -- }, + { + 'vim-airline/vim-airline', + init = function() + vim.g.airline_theme = 'everforest' + end, + }, + -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, From ded6bd76173448c91eba881b576ad7b05ea8e869 Mon Sep 17 00:00:00 2001 From: tommconley Date: Sat, 14 Dec 2024 10:31:32 -0800 Subject: [PATCH 10/15] Setup go formatting; configure diagnostics as telescope dropdown --- init.lua | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 94 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 29d1ac26eec..34ed6074b3d 100644 --- a/init.lua +++ b/init.lua @@ -363,12 +363,21 @@ require('lazy').setup({ -- You can put your default mappings / updates / etc. in here -- All the info you're looking for is in `:help telescope.setup()` -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} + defaults = { + layout_config = { + vertical = { width = 0.8, height = 0.8 }, + horizontal = { width = 0.8 }, + }, + }, + pickers = { + diagnostics = { + theme = 'dropdown', + previewer = false, + layout_config = { + width = 0.9, + }, + }, + }, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -388,11 +397,16 @@ require('lazy').setup({ vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', 'sd', function() + builtin.diagnostics { + bufnr = 0, + } + end, { desc = '[S]earch [D]iagnostics' }) + -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. @@ -527,6 +541,29 @@ require('lazy').setup({ -- For example, in C this would take you to the header. map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + vim.api.nvim_create_autocmd('BufWritePre', { + pattern = '*.go', + callback = function() + local params = vim.lsp.util.make_range_params() + params.context = { only = { 'source.organizeImports' } } + -- buf_request_sync defaults to a 1000ms timeout. Depending on your + -- machine and codebase, you may want longer. Add an additional + -- argument after params if you find that you have to write the file + -- twice for changes to be saved. + -- E.g., vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000) + local result = vim.lsp.buf_request_sync(0, 'textDocument/codeAction', params) + for cid, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or 'utf-16' + vim.lsp.util.apply_workspace_edit(r.edit, enc) + end + end + end + vim.lsp.buf.format { async = false } + end, + }) + -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed @@ -587,7 +624,17 @@ require('lazy').setup({ local servers = { ruby_lsp = {}, -- clangd = {}, - gopls = {}, + gopls = { + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + usePlaceholders = true, + }, + }, + }, -- pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs @@ -646,6 +693,44 @@ require('lazy').setup({ end, }, + { 'nvim-neotest/nvim-nio' }, + + { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'nvim-neotest/neotest-go', + }, + opts = {}, + config = function() + local neotest = require 'neotest' + + neotest.setup { + adapters = { + -- require 'neotest-rspec' { + -- rspec_cmd = function() + -- return vim.tbl_flatten { + -- 'bundle', + -- 'exec', + -- 'rspec', + -- } + -- end, + -- }, + require 'neotest-go', + }, + output_panel = { + enabled = true, + open = 'botright split | resize 15', + }, + quickfix = { + open = false, + }, + } + + vim.keymap.set('n', 'rt', "lua require('neotest').run.run()", { desc = 'Run Test' }) + end, + }, + { -- Autoformat 'stevearc/conform.nvim', event = { 'BufWritePre' }, @@ -674,6 +759,7 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, + go = { 'gofmt' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- From a0dbc79f358cc81b5103a9c3889802ea64fd8aca Mon Sep 17 00:00:00 2001 From: tommconley Date: Tue, 7 Jan 2025 08:19:23 -0800 Subject: [PATCH 11/15] move barbar to top of plugins --- init.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/init.lua b/init.lua index 34ed6074b3d..2c77f29e370 100644 --- a/init.lua +++ b/init.lua @@ -228,6 +228,22 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ + -- For view of open buffers + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', + 'nvim-tree/nvim-web-devicons', + }, + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + animation = false, + }, + version = '^1.0.0', + }, + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -320,22 +336,6 @@ require('lazy').setup({ -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - - -- For view of open buffers - { - 'romgrk/barbar.nvim', - dependencies = { - 'lewis6991/gitsigns.nvim', - 'nvim-tree/nvim-web-devicons', - }, - init = function() - vim.g.barbar_auto_setup = false - end, - opts = { - animation = false, - }, - version = '^1.0.0', - }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that From c3ac7410f8656d60a2fe390ad2ccbb2b5eab72cf Mon Sep 17 00:00:00 2001 From: tommconley Date: Tue, 7 Jan 2025 08:19:47 -0800 Subject: [PATCH 12/15] Configure golang setup --- init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 2c77f29e370..12d885a8643 100644 --- a/init.lua +++ b/init.lua @@ -365,11 +365,11 @@ require('lazy').setup({ -- defaults = { layout_config = { - vertical = { width = 0.8, height = 0.8 }, - horizontal = { width = 0.8 }, + vertical = { height = 0.9 }, }, }, pickers = { + lsp_references = { theme = 'dropdown', layout_config = { width = 0.98, height = 0.4 }, previewer = true }, diagnostics = { theme = 'dropdown', previewer = false, @@ -631,7 +631,6 @@ require('lazy').setup({ unusedparams = true, }, staticcheck = true, - usePlaceholders = true, }, }, }, @@ -727,7 +726,8 @@ require('lazy').setup({ }, } - vim.keymap.set('n', 'rt', "lua require('neotest').run.run()", { desc = 'Run Test' }) + vim.keymap.set('n', 'rt', 'lua require(\'neotest\').run.run(vim.fn.expand("%"))', { desc = 'Run Test' }) + vim.keymap.set('n', 'rot', 'lua require("neotest").output.open({ enter = true })', { desc = 'Open Test Output' }) end, }, From cc29de3052c38761716c78e0a22709048aad6613 Mon Sep 17 00:00:00 2001 From: tommconley Date: Tue, 7 Jan 2025 08:19:58 -0800 Subject: [PATCH 13/15] Add your own plugin --- init.lua | 2 +- lua/custom/plugins/init.lua | 4 +++- lua/custom/toms.nvim/lua/toms.lua | 10 ++++++++++ lua/custom/toms.nvim/plugin/load.lua | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 lua/custom/toms.nvim/lua/toms.lua create mode 100644 lua/custom/toms.nvim/plugin/load.lua diff --git a/init.lua b/init.lua index 12d885a8643..8f8db653ab7 100644 --- a/init.lua +++ b/init.lua @@ -1032,7 +1032,7 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..8163e16c50c 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,6 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + { dir = '~/.config/nvim/lua/custom/toms.nvim/' }, +} diff --git a/lua/custom/toms.nvim/lua/toms.lua b/lua/custom/toms.nvim/lua/toms.lua new file mode 100644 index 00000000000..1d15dd42e98 --- /dev/null +++ b/lua/custom/toms.nvim/lua/toms.lua @@ -0,0 +1,10 @@ +print 'loaded tom.lua' + +function List_bufs() + vim.print(vim.api.nvim_list_bufs()) +end + +-- function ListDiag() +-- +-- vim.print(vim. +-- end diff --git a/lua/custom/toms.nvim/plugin/load.lua b/lua/custom/toms.nvim/plugin/load.lua new file mode 100644 index 00000000000..28e054582d0 --- /dev/null +++ b/lua/custom/toms.nvim/plugin/load.lua @@ -0,0 +1 @@ +require 'toms' From a7100faf0a092d972861f4331f3232a3d241a103 Mon Sep 17 00:00:00 2001 From: tommconley Date: Tue, 7 Jan 2025 08:22:12 -0800 Subject: [PATCH 14/15] Add autosave --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 8f8db653ab7..614e7d41957 100644 --- a/init.lua +++ b/init.lua @@ -228,6 +228,9 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ + -- For autosave functionality + 'pocco81/auto-save.nvim', + -- For view of open buffers { 'romgrk/barbar.nvim', From 2932e263ac9d18b1693342d9cd4c5489dca92a88 Mon Sep 17 00:00:00 2001 From: tommconley Date: Thu, 6 Mar 2025 10:45:18 -0800 Subject: [PATCH 15/15] Remove barbar --- init.lua | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/init.lua b/init.lua index 614e7d41957..670dbdcebf9 100644 --- a/init.lua +++ b/init.lua @@ -231,22 +231,6 @@ require('lazy').setup({ -- For autosave functionality 'pocco81/auto-save.nvim', - -- For view of open buffers - { - 'romgrk/barbar.nvim', - dependencies = { - 'lewis6991/gitsigns.nvim', - 'nvim-tree/nvim-web-devicons', - }, - init = function() - vim.g.barbar_auto_setup = false - end, - opts = { - animation = false, - }, - version = '^1.0.0', - }, - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically