local diffview = require('diffview') local MiniDiff = require('mini.diff') local util = require('user.util') diffview.setup({ use_icons = false, signs = { fold_closed = ' ', fold_open = '-', } }) -- shows added/removed/changed lines MiniDiff.setup({ -- keymap #bracketed -- ]h / [h - navigate by hunks view = { style = 'sign', signs = { delete = '_', }, }, source = { MiniDiff.gen_source.git(), -- handle fugitive paths { name = 'fugitive', attach = function(buf_id) local resolved = util.resolve_git_path(buf_id) if not resolved or resolved.path == '' then return false end local source = vim.fn.FugitiveFind(string.format('%s~1:%s', resolved.commit, resolved.path)) local text = vim.fn['fugitive#readfile'](source) MiniDiff.set_ref_text(buf_id, text) end } } }) -- open status in current split without special flag (so navigating away closes it) -- https://github.com/tpope/vim-fugitive/issues/1296 vim.keymap.set('n', 'gs', 'Gedit :') vim.keymap.set('n', 'gb', 'Telescope git_branches') vim.keymap.set('n', 'gd', MiniDiff.toggle_overlay) vim.keymap.set('n', 'gvi', 'DiffviewOpen') vim.keymap.set('n', 'gvr', 'DiffviewFileHistory --range=origin..HEAD') -- conflicts navigation #bracketed vim.keymap.set('n', '[x', '?^[=>]\\{7}') vim.keymap.set('n', ']x', '/^[=>]\\{7}')