File tree 3 files changed +151
-0
lines changed
tests/test-sources/plugins/by-name/hunk
3 files changed +151
-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
+ Enable file type icons in the file tree.
17
+ '' ;
18
+ } ;
19
+
20
+ extraConfig = cfg : {
21
+ warnings = lib . nixvim . mkWarnings "plugins.hunk" {
22
+ when =
23
+ cfg . fileTypeIcons && ( ! config . plugins . web-devicons . enable ) && ( ! config . plugins . mini . enable ) ;
24
+ message = ''
25
+ You have enabled `fileTypeIcons` but neither
26
+ `plugins.web-devicons.enable` nor `plugins.mini.enable` are `true`.
27
+
28
+ Consider enabling either plugin for proper devicons support.
29
+ '' ;
30
+ } ;
31
+ plugins . nui . enable = true ;
32
+ } ;
33
+
34
+ settingsOptions = {
35
+ hooks =
36
+ helpers . mkNullOrOption
37
+ ( lib . types . submodule {
38
+ options = {
39
+ on_tree_mount = helpers . mkNullOrLuaFn ''
40
+ ```lua
41
+ ---@param _context { buf: number, tree: NuiTree, opts: table }
42
+ function(_context) end
43
+ ```
44
+ '' ;
45
+ on_diff_mount = helpers . mkNullOrLuaFn ''
46
+ ```lua
47
+ ---@param _context { buf: number, win: number }
48
+ function(_context) end
49
+ ```
50
+ '' ;
51
+ } ;
52
+ } )
53
+ ''
54
+ Called right after each window and buffer are created.
55
+ '' ;
56
+ } ;
57
+
58
+ # Taken directly from the plugin docs: https://github.com/julienvincent/hunk.nvim#configuration
59
+ settingsExample = {
60
+ keys = {
61
+ global = {
62
+ quit = [ "q" ] ;
63
+ accept = [ "<leader><Cr>" ] ;
64
+ focus_tree = [ "<leader>e" ] ;
65
+ } ;
66
+
67
+ tree = {
68
+ expand_node = [
69
+ "l"
70
+ "<Right>"
71
+ ] ;
72
+ collapse_node = [
73
+ "h"
74
+ "<Left>"
75
+ ] ;
76
+
77
+ open_file = [ "<Cr>" ] ;
78
+
79
+ toggle_file = [ "a" ] ;
80
+ } ;
81
+
82
+ diff = {
83
+ toggle_line = [ "a" ] ;
84
+ toggle_hunk = [ "A" ] ;
85
+ } ;
86
+ } ;
87
+
88
+ ui = {
89
+ tree = {
90
+ mode = "nested" ;
91
+ width = 35 ;
92
+ } ;
93
+ layout = "vertical" ;
94
+ } ;
95
+
96
+ icons = {
97
+ selected = "" ;
98
+ deselected = "" ;
99
+ partially_selected = "" ;
100
+
101
+ folder_open = "" ;
102
+ folder_closed = "" ;
103
+ } ;
104
+
105
+ hooks = {
106
+ on_tree_mount = lib . nixvim . mkRaw "function(_context) end" ;
107
+ on_diff_mount = lib . nixvim . mkRaw "function(_context) end" ;
108
+ } ;
109
+ } ;
110
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ empty = {
3
+ plugins . hunk . enable = true ;
4
+ } ;
5
+ with-web-devicons = {
6
+ plugins . hunk = {
7
+ enable = true ;
8
+ fileTypeIcons = true ;
9
+ } ;
10
+ plugins . web-devicons . enable = true ;
11
+ } ;
12
+ with-mini = {
13
+ plugins . hunk = {
14
+ enable = true ;
15
+ fileTypeIcons = true ;
16
+ } ;
17
+ plugins . mini = {
18
+ enable = true ;
19
+ modules . icons = { } ;
20
+ } ;
21
+ } ;
22
+ with-settings = {
23
+ plugins . hunk = {
24
+ enable = true ;
25
+ settings . ui = {
26
+ tree = {
27
+ mode = "flat" ;
28
+ width = 40 ;
29
+ } ;
30
+ layout = "horizontal" ;
31
+ } ;
32
+ } ;
33
+ } ;
34
+ }
You can’t perform that action at this time.
0 commit comments