1
1
-- Lua
2
- local cb = require ' diffview.config' .diffview_callback
2
+ local cb = require ' diffview.config' .diffview_callback
3
3
4
- require ' diffview' .setup {
5
- diff_binaries = false , -- Show diffs for binaries
4
+ require ' diffview' .setup {
5
+ diff_binaries = false , -- Show diffs for binaries
6
6
enhanced_diff_hl = false , -- See ':h diffview-config-enhanced_diff_hl'
7
- use_icons = true , -- Requires nvim-web-devicons
8
- icons = { -- Only applies when use_icons is true.
7
+ use_icons = true , -- Requires nvim-web-devicons
8
+ icons = { -- Only applies when use_icons is true.
9
9
folder_closed = " " ,
10
10
folder_open = " " ,
11
11
},
@@ -14,73 +14,77 @@ require'diffview'.setup {
14
14
fold_open = " " ,
15
15
},
16
16
file_panel = {
17
- position = " left" , -- One of 'left', 'right', 'top', 'bottom'
18
- width = 35 , -- Only applies when position is 'left' or 'right'
19
- height = 10 , -- Only applies when position is 'top' or 'bottom'
20
- listing_style = " tree" , -- One of 'list' or 'tree'
21
- tree_options = { -- Only applies when listing_style is 'tree'
22
- flatten_dirs = true , -- Flatten dirs that only contain one single dir
23
- folder_statuses = " only_folded" , -- One of 'never', 'only_folded' or 'always'.
17
+ win_config = {
18
+ position = " left" , -- One of 'left', 'right', 'top', 'bottom'
19
+ width = 35 , -- Only applies when position is 'left' or 'right'
20
+ height = 10 , -- Only applies when position is 'top' or 'bottom'
21
+ },
22
+ listing_style = " tree" , -- One of 'list' or 'tree'
23
+ tree_options = { -- Only applies when listing_style is 'tree'
24
+ flatten_dirs = true , -- Flatten dirs that only contain one single dir
25
+ folder_statuses = " only_folded" , -- One of 'never', 'only_folded' or 'always'.
24
26
},
25
27
},
26
28
file_history_panel = {
27
- position = " bottom" ,
28
- width = 35 ,
29
- height = 16 ,
29
+ win_config = {
30
+ position = " bottom" ,
31
+ width = 35 ,
32
+ height = 16 ,
33
+ },
30
34
log_options = {
31
- max_count = 256 , -- Limit the number of commits
32
- follow = false , -- Follow renames (only for single file)
33
- all = false , -- Include all refs under 'refs/' including HEAD
34
- merges = false , -- List only merge commits
35
- no_merges = false , -- List no merge commits
36
- reverse = false , -- List commits in reverse order
35
+ max_count = 256 , -- Limit the number of commits
36
+ follow = false , -- Follow renames (only for single file)
37
+ all = false , -- Include all refs under 'refs/' including HEAD
38
+ merges = false , -- List only merge commits
39
+ no_merges = false , -- List no merge commits
40
+ reverse = false , -- List commits in reverse order
37
41
},
38
42
},
39
- default_args = { -- Default args prepended to the arg-list for the listed commands
43
+ default_args = { -- Default args prepended to the arg-list for the listed commands
40
44
DiffviewOpen = {},
41
45
DiffviewFileHistory = {},
42
46
},
43
- hooks = {}, -- See ':h diffview-config-hooks'
47
+ hooks = {}, -- See ':h diffview-config-hooks'
44
48
key_bindings = {
45
- disable_defaults = false , -- Disable the default key bindings
49
+ disable_defaults = false , -- Disable the default key bindings
46
50
-- The `view` bindings are active in the diff buffers, only when the current
47
51
-- tabpage is a Diffview.
48
52
view = {
49
- [" <tab>" ] = cb (" select_next_entry" ), -- Open the diff for the next file
50
- [" <s-tab>" ] = cb (" select_prev_entry" ), -- Open the diff for the previous file
51
- [" gf" ] = cb (" goto_file" ), -- Open the file in a new split in previous tabpage
52
- [" <C-w><C-f>" ] = cb (" goto_file_split" ), -- Open the file in a new split
53
- [" <C-w>gf" ] = cb (" goto_file_tab" ), -- Open the file in a new tabpage
54
- [" <leader>e" ] = cb (" focus_files" ), -- Bring focus to the files panel
55
- [" <leader>b" ] = cb (" toggle_files" ), -- Toggle the files panel.
53
+ [" <tab>" ] = cb (" select_next_entry" ), -- Open the diff for the next file
54
+ [" <s-tab>" ] = cb (" select_prev_entry" ), -- Open the diff for the previous file
55
+ [" gf" ] = cb (" goto_file" ), -- Open the file in a new split in previous tabpage
56
+ [" <C-w><C-f>" ] = cb (" goto_file_split" ), -- Open the file in a new split
57
+ [" <C-w>gf" ] = cb (" goto_file_tab" ), -- Open the file in a new tabpage
58
+ [" <leader>e" ] = cb (" focus_files" ), -- Bring focus to the files panel
59
+ [" <leader>b" ] = cb (" toggle_files" ), -- Toggle the files panel.
56
60
},
57
61
file_panel = {
58
- [" j" ] = cb (" next_entry" ), -- Bring the cursor to the next file entry
62
+ [" j" ] = cb (" next_entry" ), -- Bring the cursor to the next file entry
59
63
[" <down>" ] = cb (" next_entry" ),
60
- [" k" ] = cb (" prev_entry" ), -- Bring the cursor to the previous file entry.
64
+ [" k" ] = cb (" prev_entry" ), -- Bring the cursor to the previous file entry.
61
65
[" <up>" ] = cb (" prev_entry" ),
62
- [" <cr>" ] = cb (" select_entry" ), -- Open the diff for the selected entry.
66
+ [" <cr>" ] = cb (" select_entry" ), -- Open the diff for the selected entry.
63
67
[" o" ] = cb (" select_entry" ),
64
68
[" <2-LeftMouse>" ] = cb (" select_entry" ),
65
- [" <Space>" ] = cb (" toggle_stage_entry" ), -- Stage / unstage the selected entry.
66
- [" S" ] = cb (" stage_all" ), -- Stage all entries.
67
- [" U" ] = cb (" unstage_all" ), -- Unstage all entries.
68
- [" r" ] = cb (" restore_entry" ), -- Restore entry to the state on the left side.
69
- [" R" ] = cb (" refresh_files" ), -- Update stats and entries in the file list.
69
+ [" <Space>" ] = cb (" toggle_stage_entry" ), -- Stage / unstage the selected entry.
70
+ [" S" ] = cb (" stage_all" ), -- Stage all entries.
71
+ [" U" ] = cb (" unstage_all" ), -- Unstage all entries.
72
+ [" r" ] = cb (" restore_entry" ), -- Restore entry to the state on the left side.
73
+ [" R" ] = cb (" refresh_files" ), -- Update stats and entries in the file list.
70
74
[" <tab>" ] = cb (" select_next_entry" ),
71
75
[" <s-tab>" ] = cb (" select_prev_entry" ),
72
76
[" gf" ] = cb (" goto_file" ),
73
77
[" <C-w><C-f>" ] = cb (" goto_file_split" ),
74
78
[" <C-w>gf" ] = cb (" goto_file_tab" ),
75
- [" i" ] = cb (" listing_style" ), -- Toggle between 'list' and 'tree' views
76
- [" f" ] = cb (" toggle_flatten_dirs" ), -- Flatten empty subdirectories in tree listing style.
79
+ [" i" ] = cb (" listing_style" ), -- Toggle between 'list' and 'tree' views
80
+ [" f" ] = cb (" toggle_flatten_dirs" ), -- Flatten empty subdirectories in tree listing style.
77
81
[" <leader>e" ] = cb (" focus_files" ),
78
82
[" <leader>b" ] = cb (" toggle_files" ),
79
83
},
80
84
file_history_panel = {
81
- [" g!" ] = cb (" options" ), -- Open the option panel
82
- [" <C-A-d>" ] = cb (" open_in_diffview" ), -- Open the entry under the cursor in a diffview
83
- [" y" ] = cb (" copy_hash" ), -- Copy the commit hash of the entry under the cursor
85
+ [" g!" ] = cb (" options" ), -- Open the option panel
86
+ [" <C-A-d>" ] = cb (" open_in_diffview" ), -- Open the entry under the cursor in a diffview
87
+ [" y" ] = cb (" copy_hash" ), -- Copy the commit hash of the entry under the cursor
84
88
[" zR" ] = cb (" open_all_folds" ),
85
89
[" zM" ] = cb (" close_all_folds" ),
86
90
[" j" ] = cb (" next_entry" ),
0 commit comments