File tree 3 files changed +166
-0
lines changed
tests/test-sources/plugins/by-name/hunk
3 files changed +166
-0
lines changed Original file line number Diff line number Diff line change 136
136
githubId = 85367527 ;
137
137
name = "Po Co" ;
138
138
} ;
139
+ jalil-salame = {
140
+
141
+ github = "jalil-salame" ;
142
+ githubId = 60845989 ;
143
+ name = "Jalil David Salamé Messina" ;
144
+ keys = [ { fingerprint = "7D6B 4D8F EBC5 7CBC 09AC 331F DA33 17E7 5BE9 485C" ; } ] ;
145
+ } ;
139
146
}
Original file line number Diff line number Diff line change
1
+ {
2
+ lib ,
3
+ helpers ,
4
+ config ,
5
+ ...
6
+ } :
7
+ lib . nixvim . plugins . mkNeovimPlugin {
8
+ name = "hunk" ;
9
+ packPathName = "hunk.nvim" ;
10
+ package = "hunk-nvim" ;
11
+
12
+ maintainers = [ lib . maintainers . jalil-salame ] ;
13
+
14
+ extraOptions = {
15
+ fileTypeIcons = lib . mkEnableOption ''
16
+ warning if file type icons are not available.
17
+ '' ;
18
+ } ;
19
+
20
+ extraConfig = cfg : {
21
+ warnings = lib . nixvim . mkWarnings "plugins.hunk" {
22
+ when = cfg . fileTypeIcons && ( ! config . plugins . web-devicons . enable ) && ( ! config . plugins . mini . enable ) ;
23
+ message = ''
24
+ You have enabled `fileTypeIcons` but neither
25
+ `plugins.web-devicons.enable` nor `plugins.mini.enable` are `true`.
26
+
27
+ Consider enabling either plugin for proper devicons support.
28
+ '' ;
29
+ } ;
30
+ plugins . nui . enable = lib . mkDefault true ;
31
+ } ;
32
+
33
+ settingsExample = {
34
+ keys . global . quit = [ "x" ] ;
35
+
36
+ ui = {
37
+ tree = {
38
+ mode = "flat" ;
39
+ width = 40 ;
40
+ } ;
41
+ layout = "horizontal" ;
42
+ } ;
43
+
44
+ hooks = {
45
+ on_tree_mount =
46
+ lib . nixvim . nestedLiteralLua # lua
47
+ ''
48
+ ---@param _context { buf: number, tree: NuiTree, opts: table }
49
+ function(_context) end
50
+ '' ;
51
+ on_diff_mount =
52
+ lib . nixvim . nestedLiteralLua # lua
53
+ ''
54
+ ---@param _context { buf: number, win: number }
55
+ function(_context) end
56
+ '' ;
57
+ } ;
58
+ } ;
59
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ empty = {
3
+ plugins . hunk . enable = true ;
4
+ } ;
5
+
6
+ with-web-devicons = {
7
+ plugins . hunk = {
8
+ enable = true ;
9
+ fileTypeIcons = true ;
10
+ } ;
11
+ plugins . web-devicons . enable = true ;
12
+ } ;
13
+
14
+ with-mini = {
15
+ plugins . hunk = {
16
+ enable = true ;
17
+ fileTypeIcons = true ;
18
+ } ;
19
+ plugins . mini = {
20
+ enable = true ;
21
+ modules . icons = { } ;
22
+ } ;
23
+ } ;
24
+
25
+ example . plugins . hunk = {
26
+ enable = true ;
27
+ settings = {
28
+ keys . global . quit = [ "x" ] ;
29
+
30
+ ui = {
31
+ tree = {
32
+ mode = "flat" ;
33
+ width = 40 ;
34
+ } ;
35
+ layout = "horizontal" ;
36
+ } ;
37
+
38
+ hooks = {
39
+ on_tree_mount . __raw = "function(_context) end" ;
40
+ on_diff_mount . __raw = "function(_context) end" ;
41
+ } ;
42
+ } ;
43
+ } ;
44
+
45
+ # Taken directly from the plugin docs: https://github.com/julienvincent/hunk.nvim#configuration
46
+ defaults . plugins . hunk = {
47
+ enable = true ;
48
+ settings = {
49
+ keys = {
50
+ global = {
51
+ quit = [ "q" ] ;
52
+ accept = [ "<leader><Cr>" ] ;
53
+ focus_tree = [ "<leader>e" ] ;
54
+ } ;
55
+
56
+ tree = {
57
+ expand_node = [
58
+ "l"
59
+ "<Right>"
60
+ ] ;
61
+ collapse_node = [
62
+ "h"
63
+ "<Left>"
64
+ ] ;
65
+
66
+ open_file = [ "<Cr>" ] ;
67
+
68
+ toggle_file = [ "a" ] ;
69
+ } ;
70
+
71
+ diff = {
72
+ toggle_line = [ "a" ] ;
73
+ toggle_hunk = [ "A" ] ;
74
+ } ;
75
+ } ;
76
+
77
+ ui = {
78
+ tree = {
79
+ mode = "nested" ;
80
+ width = 35 ;
81
+ } ;
82
+ layout = "vertical" ;
83
+ } ;
84
+
85
+ icons = {
86
+ selected = "" ;
87
+ deselected = "" ;
88
+ partially_selected = "" ;
89
+
90
+ folder_open = "" ;
91
+ folder_closed = "" ;
92
+ } ;
93
+
94
+ hooks = {
95
+ on_tree_mount . __raw = "function(_context) end" ;
96
+ on_diff_mount . __raw = "function(_context) end" ;
97
+ } ;
98
+ } ;
99
+ } ;
100
+ }
You can’t perform that action at this time.
0 commit comments