mirror of
https://github.com/Ajetski/dotfiles.git
synced 2025-09-30 13:53:17 -09:00
add gitsigns and trouble config
This commit is contained in:
parent
25ba6e80b2
commit
3e720c88d1
77
.config/nvim/after/plugin/git.lua
Normal file
77
.config/nvim/after/plugin/git.lua
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
require('gitsigns').setup {
|
||||||
|
signs = {
|
||||||
|
add = { text = '│' },
|
||||||
|
change = { text = '│' },
|
||||||
|
delete = { text = '_' },
|
||||||
|
topdelete = { text = '‾' },
|
||||||
|
changedelete = { text = '~' },
|
||||||
|
untracked = { text = '┆' },
|
||||||
|
},
|
||||||
|
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||||
|
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||||
|
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||||
|
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||||
|
watch_gitdir = {
|
||||||
|
interval = 1000,
|
||||||
|
follow_files = true
|
||||||
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 100,
|
||||||
|
status_formatter = nil, -- Use default
|
||||||
|
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||||
|
preview_config = {
|
||||||
|
-- Options passed to nvim_open_win
|
||||||
|
border = 'single',
|
||||||
|
style = 'minimal',
|
||||||
|
relative = 'cursor',
|
||||||
|
row = 0,
|
||||||
|
col = 1
|
||||||
|
},
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.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 return ']c' end
|
||||||
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true})
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true})
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||||
|
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||||
|
map('n', '<leader>hS', gs.stage_buffer)
|
||||||
|
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||||
|
map('n', '<leader>hR', gs.reset_buffer)
|
||||||
|
map('n', '<leader>hp', gs.preview_hunk)
|
||||||
|
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
||||||
|
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||||
|
map('n', '<leader>hd', gs.diffthis)
|
||||||
|
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||||
|
map('n', '<leader>td', gs.toggle_deleted)
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||||
|
end
|
||||||
|
}
|
18
.config/nvim/after/plugin/trouble.lua
Normal file
18
.config/nvim/after/plugin/trouble.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
vim.keymap.set("n", "<leader>xx", ":TroubleToggle<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xw", ":TroubleToggle workspace_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xd", ":TroubleToggle document_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xl", ":TroubleToggle loclist<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xq", ":TroubleToggle quickfix<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "gR", ":TroubleToggle lsp_references<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
@ -99,4 +99,5 @@ return require('packer').startup(function(use)
|
|||||||
end })
|
end })
|
||||||
use('Konfekt/vim-alias')
|
use('Konfekt/vim-alias')
|
||||||
use('f-person/git-blame.nvim')
|
use('f-person/git-blame.nvim')
|
||||||
|
use('lewis6991/gitsigns.nvim')
|
||||||
end)
|
end)
|
||||||
|
3
.zshrc
3
.zshrc
@ -1,3 +1,6 @@
|
|||||||
|
# temp remove me
|
||||||
|
export ARTIFACTORY_PW=QUtDcDhqUThmUERkS1dXV2JxeUJCM1ZLWGdWdlpOdVdrUjhzbnozTlREY2RiMnFYMWNubkpVcnZvenVNd3BrckdZMVBmUnhkNg==
|
||||||
|
|
||||||
# If you come from bash you might have to change your $PATH.
|
# If you come from bash you might have to change your $PATH.
|
||||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user