From 3c0b4bd1fc887ea290d166b7567e3941f3659cfc Mon Sep 17 00:00:00 2001 From: Patrick Pagni Date: Thu, 4 Jun 2026 16:27:06 +0100 Subject: [PATCH] feat: add fugitive, toggleterm, trouble plugins; configure oil - Add vim-fugitive, toggleterm, trouble.nvim lazy specs - Configure oil.nvim with hidden file toggle, sort, and float keymap - Add treesitter install callback for per-lang notifications - Enable arrow-key training keymaps Co-Authored-By: Claude Sonnet 4 --- init.lua | 20 ++++++++++++---- lazy-lock.json | 1 + lua/custom/plugins/fugitive.lua | 3 +++ lua/custom/plugins/oil.lua | 26 ++++++++++++++++++++- lua/custom/plugins/toggle-term.lua | 1 + lua/custom/plugins/trouble.lua | 37 ++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 lua/custom/plugins/fugitive.lua create mode 100644 lua/custom/plugins/toggle-term.lua create mode 100644 lua/custom/plugins/trouble.lua diff --git a/init.lua b/init.lua index b7ed2a60..62496363 100644 --- a/init.lua +++ b/init.lua @@ -214,10 +214,10 @@ do vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode - -- vim.keymap.set('n', '', 'echo "Use h to move!!"') - -- vim.keymap.set('n', '', 'echo "Use l to move!!"') - -- vim.keymap.set('n', '', 'echo "Use k to move!!"') - -- vim.keymap.set('n', '', 'echo "Use j to move!!"') + vim.keymap.set('n', '', 'echo "Use h to move!!"') + vim.keymap.set('n', '', 'echo "Use l to move!!"') + vim.keymap.set('n', '', 'echo "Use k to move!!"') + vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -574,7 +574,13 @@ require('lazy').setup({ build = ':TSUpdate', config = function() local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'python', 'query', 'sql', 'vim', 'vimdoc' } - require('nvim-treesitter').install(parsers) + require('nvim-treesitter').install(parsers, function(lang, success) + if success then + vim.notify('treesitter: installed ' .. lang, vim.log.levels.INFO) + else + vim.notify('treesitter: failed to install ' .. lang, vim.log.levels.WARN) + end + end) ---@param buf integer ---@param language string @@ -628,5 +634,9 @@ require('lazy').setup({ checker = { enabled = false }, }) + -- Open Oil in a floating window + vim.keymap.set("n", "of", "Oil --float", { desc = "Open Oil float" }) + + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lazy-lock.json b/lazy-lock.json index 65c7e00d..5e76c7dd 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -30,6 +30,7 @@ "telescope.nvim": { "branch": "master", "commit": "7d324792b7943e4aa16ad007212e6acc6f9fe335" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "wezterm.nvim": { "branch": "main", "commit": "032c33b621b96cc7228955b4352b48141c482098" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lua/custom/plugins/fugitive.lua b/lua/custom/plugins/fugitive.lua new file mode 100644 index 00000000..2c2efeb2 --- /dev/null +++ b/lua/custom/plugins/fugitive.lua @@ -0,0 +1,3 @@ +return { + "tpope/vim-fugitive", +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 966924f2..2a751fd6 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -3,6 +3,30 @@ return { dependencies = { 'nvim-mini/mini.nvim' }, config = function() require('mini.icons').setup() - require('oil').setup() + require('oil').setup { + view_options = { + show_hidden = false, + is_hidden_file = function(name, bufnr) + return vim.startswith(name, '.') + end, + is_always_hidden = function(name, bufnr) + return false + end, + natural_order = false, + sort = { + { 'type', 'asc' }, + { 'name', 'asc' }, + }, + }, + keymaps = { + ['th'] = { + callback = function() + require('oil').toggle_hidden() + end, + desc = 'Toggle hidden files', + mode = 'n', + }, + }, + } end, } diff --git a/lua/custom/plugins/toggle-term.lua b/lua/custom/plugins/toggle-term.lua new file mode 100644 index 00000000..9ac87b18 --- /dev/null +++ b/lua/custom/plugins/toggle-term.lua @@ -0,0 +1 @@ +return {'akinsho/toggleterm.nvim', version = "*", config = true} diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua new file mode 100644 index 00000000..3741f30a --- /dev/null +++ b/lua/custom/plugins/trouble.lua @@ -0,0 +1,37 @@ +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +}