From 143e63831568a91a0a7e614dc1be8d9ac25c0750 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sat, 3 Feb 2024 02:37:58 -0600 Subject: refactor: move all git related plugins to git.lua --- lua/plugins/git.lua | 56 ++++++++++++++++++++++++++++------------------------ lua/plugins/init.lua | 3 --- 2 files changed, 30 insertions(+), 29 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index a40a3dc..b579647 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -1,31 +1,35 @@ return { - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = true, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - on_attach = function(bufnr) - local gs = require('gitsigns') + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + { + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = true, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + on_attach = function(bufnr) + local gs = require('gitsigns') - -- TODO: use this function for most of the keymaps across plugins? - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end + -- TODO: use this function for most of the keymaps across plugins? + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end - map('n', 'gp', gs.prev_hunk, { desc = '[g]it: [p]revious hunk' }) - map('n', 'gn', gs.next_hunk, { desc = '[g]it: [n]ext hunk' }) - map('n', 'gv', gs.preview_hunk, { desc = '[g]it: [v]iew hunk' }) - map('n', 'gb', gs.toggle_current_line_blame, { desc = '[g]it: [b]lame toggle' }) - end, + map('n', 'gp', gs.prev_hunk, { desc = '[g]it: [p]revious hunk' }) + map('n', 'gn', gs.next_hunk, { desc = '[g]it: [n]ext hunk' }) + map('n', 'gv', gs.preview_hunk, { desc = '[g]it: [v]iew hunk' }) + map('n', 'gb', gs.toggle_current_line_blame, { desc = '[g]it: [b]lame toggle' }) + end, + }, }, } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 59d822a..28ed11b 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,7 +1,4 @@ return { - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically, -- uses .editorconfig https://editorconfig.org/ 'tpope/vim-sleuth', -- cgit v1.2.3-70-g09d2