@@ -188,13 +188,31 @@ require("diffview").setup({
188188 enhanced_diff_hl = false , -- See |diffview-config-enhanced_diff_hl|
189189 git_cmd = { " git" }, -- The git executable followed by default args.
190190 hg_cmd = { " hg" }, -- The hg executable followed by default args.
191- use_icons = true , -- Requires nvim-web-devicons
191+ rename_threshold = nil , -- Similarity threshold for rename detection (e.g. 40 for 40%). Nil uses git default (50%).
192+ use_icons = true , -- Requires nvim-web-devicons or mini.icons
192193 show_help_hints = true , -- Show hints for how to open the help panel
193194 watch_index = true , -- Update views and index buffers when the git index changes.
195+ hide_merge_artifacts = false , -- Hide merge artifact files (*.orig, *.BACKUP.*, *.BASE.*, *.LOCAL.*, *.REMOTE.*)
196+ auto_close_on_empty = false , -- Close diffview when the last file is staged/resolved
197+ diffopt = {}, -- Override diffopt settings while diffview is open. Restored on close.
198+ clean_up_buffers = false , -- Delete file buffers created by diffview on close.
194199 icons = { -- Only applies when use_icons is true.
195200 folder_closed = " " ,
196201 folder_open = " " ,
197202 },
203+ status_icons = { -- Configure icons for git status letters.
204+ [" A" ] = " A" , -- Added
205+ [" ?" ] = " ?" , -- Untracked
206+ [" M" ] = " M" , -- Modified
207+ [" R" ] = " R" , -- Renamed
208+ [" C" ] = " C" , -- Copied
209+ [" T" ] = " T" , -- Type changed
210+ [" U" ] = " U" , -- Unmerged
211+ [" X" ] = " X" , -- Unknown
212+ [" D" ] = " D" , -- Deleted
213+ [" B" ] = " B" , -- Broken
214+ [" !" ] = " !" , -- Ignored
215+ },
198216 signs = {
199217 fold_closed = " " ,
200218 fold_open = " " ,
@@ -229,9 +247,15 @@ require("diffview").setup({
229247 disable_diagnostics = false , -- Temporarily disable diagnostics for diff buffers while in the view.
230248 winbar_info = false , -- See |diffview-config-view.x.winbar_info|
231249 },
250+ -- Layouts to cycle through with `cycle_layout` action.
251+ cycle_layouts = {
252+ default = { " diff2_horizontal" , " diff2_vertical" },
253+ merge_tool = { " diff3_horizontal" , " diff3_vertical" , " diff3_mixed" , " diff4_mixed" , " diff1_plain" },
254+ },
232255 },
233256 file_panel = {
234257 listing_style = " tree" , -- One of 'list' or 'tree'
258+ sort_file = nil , -- Custom file comparator: function(a_name, b_name, a_data, b_data) -> boolean
235259 tree_options = { -- Only applies when listing_style is 'tree'
236260 flatten_dirs = true , -- Flatten dirs that only contain one single dir
237261 folder_statuses = " only_folded" , -- One of 'never', 'only_folded' or 'always'.
@@ -241,12 +265,20 @@ require("diffview").setup({
241265 width = 35 ,
242266 win_opts = {},
243267 },
268+ show = true , -- Show the file panel when opening Diffview.
269+ always_show_sections = false , -- Always show Changes and Staged changes sections even when empty.
270+ show_branch_name = false , -- Show branch name in the file panel header.
244271 },
245272 file_history_panel = {
273+ stat_style = " number" , -- "number" (e.g. "5, 3"), "bar" (e.g. "| 8 +++++---"), or "both".
274+ -- Ordered list of components to show for each commit entry.
275+ -- Available: "status", "files", "stats", "hash", "reflog", "ref", "subject", "author", "date"
276+ commit_format = { " status" , " files" , " stats" , " hash" , " reflog" , " ref" , " subject" , " author" , " date" },
246277 log_options = { -- See |diffview-config-log_options|
247278 git = {
248279 single_file = {
249- diff_merges = " combined" ,
280+ diff_merges = " first-parent" ,
281+ follow = true ,
250282 },
251283 multi_file = {
252284 diff_merges = " first-parent" ,
@@ -262,6 +294,8 @@ require("diffview").setup({
262294 height = 16 ,
263295 win_opts = {},
264296 },
297+ commit_subject_max_length = 72 , -- Max length for commit subject display.
298+ date_format = " auto" , -- Date format: "auto" | "relative" | "iso"
265299 },
266300 commit_log_panel = {
267301 win_config = {}, -- See |diffview-config-win_config|
@@ -283,6 +317,8 @@ require("diffview").setup({
283317 { " n" , " gf" , actions .goto_file_edit , { desc = " Open the file in the previous tabpage" } },
284318 { " n" , " <C-w><C-f>" , actions .goto_file_split , { desc = " Open the file in a new split" } },
285319 { " n" , " <C-w>gf" , actions .goto_file_tab , { desc = " Open the file in a new tabpage" } },
320+ { " n" , " gx" , actions .open_file_external , { desc = " Open the file with default system application" } },
321+ { " n" , " <C-w>T" , actions .open_in_new_tab , { desc = " Open diffview in a new tab" } },
286322 { " n" , " <leader>e" , actions .focus_files , { desc = " Bring focus to the file panel" } },
287323 { " n" , " <leader>b" , actions .toggle_files , { desc = " Toggle the file panel." } },
288324 { " n" , " g<C-x>" , actions .cycle_layout , { desc = " Cycle through available layouts." } },
@@ -350,6 +386,8 @@ require("diffview").setup({
350386 { " n" , " gf" , actions .goto_file_edit , { desc = " Open the file in the previous tabpage" } },
351387 { " n" , " <C-w><C-f>" , actions .goto_file_split , { desc = " Open the file in a new split" } },
352388 { " n" , " <C-w>gf" , actions .goto_file_tab , { desc = " Open the file in a new tabpage" } },
389+ { " n" , " gx" , actions .open_file_external , { desc = " Open the file with default system application" } },
390+ { " n" , " <C-w>T" , actions .open_in_new_tab , { desc = " Open diffview in a new tab" } },
353391 { " n" , " i" , actions .listing_style , { desc = " Toggle between 'list' and 'tree' views" } },
354392 { " n" , " f" , actions .toggle_flatten_dirs , { desc = " Flatten empty subdirectories in tree listing style" } },
355393 { " n" , " R" , actions .refresh_files , { desc = " Update stats and entries in the file list" } },
@@ -368,6 +406,7 @@ require("diffview").setup({
368406 file_history_panel = {
369407 { " n" , " g!" , actions .options , { desc = " Open the option panel" } },
370408 { " n" , " <C-A-d>" , actions .open_in_diffview , { desc = " Open the entry under the cursor in a diffview" } },
409+ { " n" , " H" , actions .diff_against_head , { desc = " Open a diffview comparing HEAD with the commit under the cursor" } },
371410 { " n" , " y" , actions .copy_hash , { desc = " Copy the commit hash of the entry under the cursor" } },
372411 { " n" , " L" , actions .open_commit_log , { desc = " Show commit details" } },
373412 { " n" , " X" , actions .restore_entry , { desc = " Restore file to the state from the selected entry" } },
@@ -394,6 +433,7 @@ require("diffview").setup({
394433 { " n" , " gf" , actions .goto_file_edit , { desc = " Open the file in the previous tabpage" } },
395434 { " n" , " <C-w><C-f>" , actions .goto_file_split , { desc = " Open the file in a new split" } },
396435 { " n" , " <C-w>gf" , actions .goto_file_tab , { desc = " Open the file in a new tabpage" } },
436+ { " n" , " gx" , actions .open_file_external , { desc = " Open the file with default system application" } },
397437 { " n" , " <leader>e" , actions .focus_files , { desc = " Bring focus to the file panel" } },
398438 { " n" , " <leader>b" , actions .toggle_files , { desc = " Toggle the file panel" } },
399439 { " n" , " g<C-x>" , actions .cycle_layout , { desc = " Cycle available layouts" } },
0 commit comments