-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-config.lua
More file actions
86 lines (71 loc) · 2.63 KB
/
Copy pathgit-config.lua
File metadata and controls
86 lines (71 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local gitsigns_module = {
'lewis6991/gitsigns.nvim',
event = 'VeryLazy',
}
gitsigns_module.opts = {
gh = true,
signcolumn = true,
numhl = true,
preview_config = {
border = 'solid',
row = 1,
col = -1,
},
on_attach = function(bufnr)
local git_keymap = require('config.keymaps').git
local gitsigns_actions = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
map('n', git_keymap.next_hunk,
function()
if vim.wo.diff then
vim.cmd.normal({ git_keymap.next_hunk, bang = true })
else
gitsigns_actions.nav_hunk('next')
end
end)
map('n', git_keymap.prev_hunk,
function()
if vim.wo.diff then
vim.cmd.normal({ git_keymap.prev_hunk, bang = true })
else
gitsigns_actions.nav_hunk('prev')
end
end)
map('n', git_keymap.stage_hunk, gitsigns_actions.stage_hunk)
map('v', git_keymap.stage_hunk,
function() gitsigns_actions.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
map('n', git_keymap.reset_hunk, gitsigns_actions.reset_hunk)
map('v', git_keymap.reset_hunk,
function() gitsigns_actions.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
map('n', git_keymap.blame_line, function() gitsigns_actions.blame_line { full = true } end)
map('n', git_keymap.toggle_blame, gitsigns_actions.toggle_current_line_blame)
map('n', git_keymap.diff_this, gitsigns_actions.diffthis)
end
}
local inlinediff_module = {
'cvlmtg/inline-diff.nvim',
cmd = 'InlineDiff',
}
inlinediff_module.config = function()
require('inline-diff').setup()
-- prevent enable() from resetting our highlights on every toggle
require('inline-diff.highlight').define = function() end
vim.api.nvim_set_hl(0, 'InlineDiffAdd', { fg = '#78b9b7', bg = '#0e2324' })
vim.api.nvim_set_hl(0, 'InlineDiffWordAdd', { fg = '#d0eeec', bg = '#1e5554' })
vim.api.nvim_set_hl(0, 'InlineDiffDelete', { fg = '#be6f90', bg = '#2a161d' })
vim.api.nvim_set_hl(0, 'InlineDiffWordDel', { fg = '#eaced8', bg = '#532740' })
end
inlinediff_module.keys = function()
local git_keymap = require('config.keymaps').git
return {
{ git_keymap.preview_hunk, function() require('inline-diff').toggle() end }
}
end
return {
gitsigns_module,
inlinediff_module
}