diff --git a/after/plugin/git_stuff.lua b/after/plugin/git_stuff.lua new file mode 100644 index 0000000..bed8592 --- /dev/null +++ b/after/plugin/git_stuff.lua @@ -0,0 +1,48 @@ +require('gitsigns').setup{ + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 200, + ignore_whitespace = false, + virt_text_priority = 100, + }, + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({']c', bang = true}) + else + gitsigns.nav_hunk('next') + end + end) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({'[c', bang = true}) + else + gitsigns.nav_hunk('prev') + end + end) + + -- Actions + map('n', 'hs', gitsigns.stage_hunk) + map('n', 'hr', gitsigns.reset_hunk) + map('n', 'hS', gitsigns.stage_buffer) + map('n', 'hu', gitsigns.undo_stage_hunk) + map('n', 'hR', gitsigns.reset_buffer) + map('n', 'hp', gitsigns.preview_hunk) + map('n', 'hb', function() gitsigns.blame_line{full=true} end) + map('n', 'tb', gitsigns.toggle_current_line_blame) + map('n', 'hd', gitsigns.diffthis) + map('n', 'hD', function() gitsigns.diffthis('~') end) + map('n', 'td', gitsigns.toggle_deleted) + end +} diff --git a/after/plugin/neotree.lua b/after/plugin/neotree.lua index c1a0c9d..1d11996 100644 --- a/after/plugin/neotree.lua +++ b/after/plugin/neotree.lua @@ -2,6 +2,7 @@ require('neo-tree').setup({ sources = { "filesystem", "buffers", + "git_status", }, filesystem = { filtered_items = { @@ -10,7 +11,7 @@ require('neo-tree').setup({ hide_hidden = false, hide_dotfiles = false, }, - follow_current_file = + follow_current_file = { enabled = true, }, diff --git a/lua/pippy/lazy.lua b/lua/pippy/lazy.lua index 135f0cc..4ad58c6 100644 --- a/lua/pippy/lazy.lua +++ b/lua/pippy/lazy.lua @@ -13,10 +13,8 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ "folke/which-key.nvim", - {"nvim-treesitter/nvim-treesitter", build = ':TSUpdate'}, "nvim-treesitter/playground", - { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", @@ -26,17 +24,9 @@ require("lazy").setup({ "MunifTanjim/nui.nvim", } }, - - -- { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, "navarasu/onedark.nvim", - "mbbill/undotree", - { 'nvim-lualine/lualine.nvim', requires = { 'nvim-tree/nvim-web-devicons', opt = true } }, - - -- { 'feline-nvim/feline.nvim', branch = '0.5-compat' }, - -- - { 'nvim-telescope/telescope.nvim', tag = '0.1.3', @@ -57,7 +47,7 @@ require("lazy").setup({ {'hrsh7th/cmp-nvim-lsp'}, {'hrsh7th/nvim-cmp'}, {'L3MON4D3/LuaSnip'}, - + 'lewis6991/gitsigns.nvim', {'xiyaowong/transparent.nvim'}, { 'numToStr/Comment.nvim', opts = {} }, })