mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
use gitsigns instead of signify
This commit is contained in:
parent
a39befff93
commit
b504c932e6
44
lua/config/gitsigns.lua
Normal file
44
lua/config/gitsigns.lua
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
local gs = require "gitsigns"
|
||||||
|
|
||||||
|
gs.setup {
|
||||||
|
signs = {
|
||||||
|
add = { hl = "GitSignsAdd", text = "+", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||||
|
change = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||||
|
delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||||
|
topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||||
|
changedelete = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||||
|
},
|
||||||
|
word_diff = true, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
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
|
||||||
|
return "]c"
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
gs.next_hunk()
|
||||||
|
end)
|
||||||
|
return "<Ignore>"
|
||||||
|
end, { expr = true, desc = 'next hunk' })
|
||||||
|
|
||||||
|
map("n", "[c", function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
return "[c"
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
gs.prev_hunk()
|
||||||
|
end)
|
||||||
|
return "<Ignore>"
|
||||||
|
end, { expr = true, desc = 'previous hunk' })
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map("n", "<leader>hp", gs.preview_hunk)
|
||||||
|
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
|
||||||
|
end,
|
||||||
|
}
|
||||||
@ -132,10 +132,6 @@ packer.startup({
|
|||||||
use({"rebelot/kanagawa.nvim", opt = true})
|
use({"rebelot/kanagawa.nvim", opt = true})
|
||||||
use({"catppuccin/nvim", as = "catppuccin", opt = true})
|
use({"catppuccin/nvim", as = "catppuccin", opt = true})
|
||||||
|
|
||||||
-- Show git change (change, delete, add) signs in vim sign column
|
|
||||||
use({"mhinz/vim-signify", event = 'BufEnter'})
|
|
||||||
-- Another similar plugin
|
|
||||||
-- use 'airblade/vim-gitgutter'
|
|
||||||
|
|
||||||
use {'kyazdani42/nvim-web-devicons', event = 'VimEnter'}
|
use {'kyazdani42/nvim-web-devicons', event = 'VimEnter'}
|
||||||
|
|
||||||
@ -244,6 +240,8 @@ packer.startup({
|
|||||||
}
|
}
|
||||||
|
|
||||||
use({ "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] })
|
use({ "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] })
|
||||||
|
-- Show git change (change, delete, add) signs in vim sign column
|
||||||
|
use({ 'lewis6991/gitsigns.nvim', config = [[require('config.gitsigns')]] })
|
||||||
|
|
||||||
-- Better git commit experience
|
-- Better git commit experience
|
||||||
use({"rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]]})
|
use({"rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]]})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user