diff --git a/nvim/colors.vimrc b/nvim/colors.vimrc index 8ae271f..f6cfc23 100644 --- a/nvim/colors.vimrc +++ b/nvim/colors.vimrc @@ -27,11 +27,11 @@ function! s:sonokai_custom() abort call sonokai#highlight('SignColumn', l:palette.fg, l:palette.bg1) call sonokai#highlight('Terminal', l:palette.fg, l:palette.bg1) call sonokai#highlight('VertSplit', l:palette.bg1, l:palette.none) - call sonokai#highlight('CocGitAddedSign', l:palette.green, l:palette.bg1) - call sonokai#highlight('CocGitChangeRemovedSign', l:palette.purple, l:palette.bg1) - call sonokai#highlight('CocGitChangedSign', l:palette.blue, l:palette.bg1) - call sonokai#highlight('CocGitRemovedSign', l:palette.red, l:palette.bg1) - call sonokai#highlight('CocGitTopRemovedSign', l:palette.red, l:palette.bg1) + call sonokai#highlight('GitSignsAdd', l:palette.green, l:palette.bg1) + call sonokai#highlight('GitSignsChange', l:palette.blue, l:palette.bg1) + call sonokai#highlight('GitSignsChangeDelete', l:palette.purple, l:palette.bg1) + call sonokai#highlight('GitSignsDelete', l:palette.red, l:palette.bg1) + call sonokai#highlight('GitSignsTopDelete', l:palette.orange, l:palette.bg1) call sonokai#highlight('BlueSign', l:palette.blue, l:palette.bg1) call sonokai#highlight('GreenSign', l:palette.green, l:palette.bg1) call sonokai#highlight('RedSign', l:palette.red, l:palette.bg1) diff --git a/nvim/gitsigns.vimrc b/nvim/gitsigns.vimrc new file mode 100644 index 0000000..9ea5d97 --- /dev/null +++ b/nvim/gitsigns.vimrc @@ -0,0 +1,66 @@ +lua << EOF +require('gitsigns').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 = 'GitSignsTopDelete', text = '█', numhl='GitSignsTopDeleteNr', linehl='GitSignsTopDeleteLn'}, + changedelete = {hl = 'GitSignsChangeDelete', text = '█', numhl='GitSignsChangeDeleteNr', linehl='GitSignsChangeDeleteLn'}, + }, + 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` + keymaps = { + -- Default keymap options + noremap = true, + + ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'"}, + ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'"}, + + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['v hs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hr'] = 'lua require"gitsigns".reset_hunk()', + ['v hr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hR'] = 'lua require"gitsigns".reset_buffer()', + ['n hp'] = 'lua require"gitsigns".preview_hunk()', + ['n hb'] = 'lua require"gitsigns".blame_line(true)', + ['n hS'] = 'lua require"gitsigns".stage_buffer()', + ['n hU'] = 'lua require"gitsigns".reset_buffer_index()', + + -- Text objects + ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', + ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' + }, + 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, + }, + current_line_blame_formatter_opts = { + relative_time = false + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, +} +EOF diff --git a/nvim/plugins.vimrc b/nvim/plugins.vimrc index b945576..a39a376 100644 --- a/nvim/plugins.vimrc +++ b/nvim/plugins.vimrc @@ -25,6 +25,10 @@ Plug 'neovim/nvim-lspconfig' | \ Plug 'hrsh7th/vim-vsnip' | \ Plug 'rafamadriz/friendly-snippets' +" Gitsigns +Plug 'nvim-lua/plenary.nvim' | + \ Plug 'lewis6991/gitsigns.nvim' + " Lightline Plug 'itchyny/lightline.vim' | \ Plug 'albertomontesg/lightline-asyncrun' | diff --git a/vimrc b/vimrc index eedf8d2..05ca9ca 100644 --- a/vimrc +++ b/vimrc @@ -83,6 +83,11 @@ if filereadable(expand("~/.config/nvim/keybindings.vimrc")) source ~/.config/nvim/keybindings.vimrc endif +" Gitsigns setup +if filereadable(expand("~/.config/nvim/gitsigns.vimrc")) + source ~/.config/nvim/gitsigns.vimrc +endif + " Lightline setup if filereadable(expand("~/.config/nvim/lightline.vimrc")) source ~/.config/nvim/lightline.vimrc