diff --git a/lazy-lock.json b/lazy-lock.json index 0831d179..5f7ad537 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -19,7 +19,6 @@ "nvim-treesitter": { "branch": "master", "commit": "ab818bf5a2ee21515ade9afcf428e98056b6197b" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" }, "oil.nvim": { "branch": "master", "commit": "24027ed8d7f3ee5c38cfd713915e2e16d89e79b3" }, - "onedark.nvim": { "branch": "master", "commit": "c5476a091b0f1b4e853db91c91ff941f848a1cdd" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, diff --git a/lua/plugins/fugitive.lua b/lua/plugins/fugitive.lua new file mode 100644 index 00000000..af264934 --- /dev/null +++ b/lua/plugins/fugitive.lua @@ -0,0 +1,9 @@ +return { 'tpope/vim-fugitive', + config = function() + vim.keymap.set('n', 'gs', 'Git', { desc = '[G]it [S]tatus' }); + vim.keymap.set('n', 'ga', 'Git add -A', { desc = 'Stage [A]ll [G]it files' }); + vim.keymap.set('n', 'gc', 'Git commit', { desc = '[C]ommit staged [G]it files' }); + vim.keymap.set('n', 'gg', 'Git log --graph --oneline --decorate=short', { desc = '[G]it log [G]raph' }); + vim.keymap.set('n', 'gb', 'Git blame', { desc = '[G]it [B]lame' }); + end +}; diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 0b1c7378..9865461d 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -41,33 +41,28 @@ return { -- Actions -- visual mode - map('v', 'hs', function() + map('v', 'ghs', function() gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() + end, { desc = '[S]tage [G]it [H]unk' }) + map('v', 'ghr', function() gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) + end, { desc = '[R]eset [G]it [H]unk' }) -- normal mode - map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) - map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) - map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) - map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) - map('n', 'hb', function() + map('n', 'ghs', gs.stage_hunk, { desc = '[G]it [S]tage [H]unk' }) + map('n', 'ghr', gs.reset_hunk, { desc = '[G]it [R]eset [H]unk' }) + map('n', 'ghS', gs.stage_buffer, { desc = '[G]it [S]tage buffer' }) + map('n', 'ghu', gs.undo_stage_hunk, { desc = '[U]ndo stage [H]unk' }) + map('n', 'ghR', gs.reset_buffer, { desc = '[G]it [R]eset buffer' }) + map('n', 'ghp', gs.preview_hunk, { desc = '[P]review [G]it [H]unk' }) + map('n', 'ghb', function() gs.blame_line { full = false } - end, { desc = 'git blame line' }) - map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) - map('n', 'hD', function() - gs.diffthis '~' - end, { desc = 'git diff against last commit' }) + end, { desc = '[G]it blame line' }) -- Toggles - map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) - map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + map('n', 'ghx', gs.toggle_deleted, { desc = 'toggle [G]it show deleted' }) -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select [G]it [H]unk' }) end } } diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 7dc820a9..2e7edbc9 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -5,10 +5,9 @@ return { 'folke/which-key.nvim', opts = {}, ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, + ['gh'] = { name = '[G]it [H]unk', _ = 'which_key_ignore' }, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, } -- register which-key VISUAL mode