From 2c7b0546bfd42da01b05992327b240ff11bff50f Mon Sep 17 00:00:00 2001 From: Fernando Ayats Date: Fri, 9 Aug 2024 16:03:06 +0200 Subject: [PATCH] add gitsigns --- modules/wrapper-manager/neovim/generated.json | 20 +++++++++++++++++++ modules/wrapper-manager/neovim/generated.nix | 11 ++++++++++ modules/wrapper-manager/neovim/nvfetcher.toml | 4 ++++ .../viper-init-plugin/lua/viper/init.lua | 9 +++++++++ 4 files changed, 44 insertions(+) diff --git a/modules/wrapper-manager/neovim/generated.json b/modules/wrapper-manager/neovim/generated.json index 8e5f38c2..a72f1e2a 100644 --- a/modules/wrapper-manager/neovim/generated.json +++ b/modules/wrapper-manager/neovim/generated.json @@ -118,6 +118,26 @@ }, "version": "v7.0.0" }, + "gitsigns-nvim": { + "cargoLocks": null, + "date": null, + "extract": null, + "name": "gitsigns-nvim", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "lewis6991", + "repo": "gitsigns.nvim", + "rev": "v0.9.0", + "sha256": "sha256-AbnjBqKLhOGMGBXBnu9zbL3PG7rKmAoYtxY17kzFEIA=", + "type": "github" + }, + "version": "v0.9.0" + }, "guess-indent-nvim": { "cargoLocks": null, "date": "2024-07-06", diff --git a/modules/wrapper-manager/neovim/generated.nix b/modules/wrapper-manager/neovim/generated.nix index bd1763db..a60f4685 100644 --- a/modules/wrapper-manager/neovim/generated.nix +++ b/modules/wrapper-manager/neovim/generated.nix @@ -72,6 +72,17 @@ sha256 = "sha256-0gBvpqsBn7KlpIPANPa3nf2TC7EBm4s47V+TFbr7RVU="; }; }; + gitsigns-nvim = { + pname = "gitsigns-nvim"; + version = "v0.9.0"; + src = fetchFromGitHub { + owner = "lewis6991"; + repo = "gitsigns.nvim"; + rev = "v0.9.0"; + fetchSubmodules = false; + sha256 = "sha256-AbnjBqKLhOGMGBXBnu9zbL3PG7rKmAoYtxY17kzFEIA="; + }; + }; guess-indent-nvim = { pname = "guess-indent-nvim"; version = "6cd61f7a600bb756e558627cd2e740302c58e32d"; diff --git a/modules/wrapper-manager/neovim/nvfetcher.toml b/modules/wrapper-manager/neovim/nvfetcher.toml index 895b98cc..25d6d2e3 100644 --- a/modules/wrapper-manager/neovim/nvfetcher.toml +++ b/modules/wrapper-manager/neovim/nvfetcher.toml @@ -109,3 +109,7 @@ src.git = "https://github.com/coffebar/neovim-project" [cmp-async-path] fetch.git = "https://codeberg.org/FelipeLema/cmp-async-path" src.git = "https://codeberg.org/FelipeLema/cmp-async-path" + +[gitsigns-nvim] +fetch.github = "lewis6991/gitsigns.nvim" +src.github = "lewis6991/gitsigns.nvim" diff --git a/modules/wrapper-manager/neovim/viper-init-plugin/lua/viper/init.lua b/modules/wrapper-manager/neovim/viper-init-plugin/lua/viper/init.lua index 9b072f9d..2309ba80 100644 --- a/modules/wrapper-manager/neovim/viper-init-plugin/lua/viper/init.lua +++ b/modules/wrapper-manager/neovim/viper-init-plugin/lua/viper/init.lua @@ -431,3 +431,12 @@ vim.keymap.set("n", "p", "Telescope neovim-project discover", { vim.filetype.add({ filename = { ['.envrc'] = 'bash' }, }) + +local gitsigns = require('gitsigns') +gitsigns.setup() + +vim.keymap.set("n", "ga", gitsigns.stage_hunk, { desc = "Git: stage hunk" }) +vim.keymap.set("n", "gp", gitsigns.preview_hunk, { desc = "Git: preview hunk" }) +vim.keymap.set("n", "gb", function() + gitsigns.blame_line({full=true}) +end, { desc = "Git: blame line" })