File tree 5 files changed +73
-49
lines changed
5 files changed +73
-49
lines changed Original file line number Diff line number Diff line change @@ -371,22 +371,27 @@ return {
371
371
browser = nil , --- @type string ?
372
372
throttle = 20 , -- how frequently should the ui process render events
373
373
custom_keys = {
374
- -- you can define custom key maps here.
375
- -- To disable one of the defaults, set it to false
376
-
377
- -- open lazygit log
378
- [" <localleader>l" ] = function (plugin )
379
- require (" lazy.util" ).float_term ({ " lazygit" , " log" }, {
380
- cwd = plugin .dir ,
381
- })
382
- end ,
383
-
384
- -- open a terminal for the plugin dir
385
- [" <localleader>t" ] = function (plugin )
386
- require (" lazy.util" ).float_term (nil , {
387
- cwd = plugin .dir ,
388
- })
389
- end ,
374
+ -- You can define custom key maps here. If present, the description will
375
+ -- be shown in the help menu.
376
+ -- To disable one of the defaults, set it to false.
377
+
378
+ [" <localleader>l" ] = {
379
+ function (plugin )
380
+ require (" lazy.util" ).float_term ({ " lazygit" , " log" }, {
381
+ cwd = plugin .dir ,
382
+ })
383
+ end ,
384
+ desc = " Open lazygit log" ,
385
+ },
386
+
387
+ [" <localleader>t" ] = {
388
+ function (plugin )
389
+ require (" lazy.util" ).float_term (nil , {
390
+ cwd = plugin .dir ,
391
+ })
392
+ end ,
393
+ desc = " Open terminal in plugin dir" ,
394
+ },
390
395
},
391
396
},
392
397
diff = {
Original file line number Diff line number Diff line change @@ -473,22 +473,27 @@ CONFIGURATION *lazy.nvim-lazy.nvim-configuration*
473
473
browser = nil, ---@type string?
474
474
throttle = 20, -- how frequently should the ui process render events
475
475
custom_keys = {
476
- -- you can define custom key maps here.
477
- -- To disable one of the defaults, set it to false
478
-
479
- -- open lazygit log
480
- ["<localleader> l"] = function(plugin)
481
- require("lazy.util").float_term({ "lazygit", "log" }, {
482
- cwd = plugin.dir,
483
- })
484
- end,
485
-
486
- -- open a terminal for the plugin dir
487
- ["<localleader> t"] = function(plugin)
488
- require("lazy.util").float_term(nil, {
489
- cwd = plugin.dir,
490
- })
491
- end,
476
+ -- You can define custom key maps here. If present, the description will
477
+ -- be shown in the help menu.
478
+ -- To disable one of the defaults, set it to false.
479
+
480
+ ["<localleader> l"] = {
481
+ function(plugin)
482
+ require("lazy.util").float_term({ "lazygit", "log" }, {
483
+ cwd = plugin.dir,
484
+ })
485
+ end,
486
+ desc = "Open lazygit log",
487
+ },
488
+
489
+ ["<localleader> t"] = {
490
+ function(plugin)
491
+ require("lazy.util").float_term(nil, {
492
+ cwd = plugin.dir,
493
+ })
494
+ end,
495
+ desc = "Open terminal in plugin dir",
496
+ },
492
497
},
493
498
},
494
499
diff = {
Original file line number Diff line number Diff line change @@ -81,22 +81,27 @@ M.defaults = {
81
81
browser = nil , --- @type string ?
82
82
throttle = 20 , -- how frequently should the ui process render events
83
83
custom_keys = {
84
- -- you can define custom key maps here.
85
- -- To disable one of the defaults, set it to false
84
+ -- You can define custom key maps here. If present, the description will
85
+ -- be shown in the help menu.
86
+ -- To disable one of the defaults, set it to false.
86
87
87
- -- open lazygit log
88
- [" <localleader>l" ] = function (plugin )
89
- require (" lazy.util" ).float_term ({ " lazygit" , " log" }, {
90
- cwd = plugin .dir ,
91
- })
92
- end ,
88
+ [" <localleader>l" ] = {
89
+ function (plugin )
90
+ require (" lazy.util" ).float_term ({ " lazygit" , " log" }, {
91
+ cwd = plugin .dir ,
92
+ })
93
+ end ,
94
+ desc = " Open lazygit log" ,
95
+ },
93
96
94
- -- open a terminal for the plugin dir
95
- [" <localleader>t" ] = function (plugin )
96
- require (" lazy.util" ).float_term (nil , {
97
- cwd = plugin .dir ,
98
- })
99
- end ,
97
+ [" <localleader>t" ] = {
98
+ function (plugin )
99
+ require (" lazy.util" ).float_term (nil , {
100
+ cwd = plugin .dir ,
101
+ })
102
+ end ,
103
+ desc = " Open terminal in plugin dir" ,
104
+ },
100
105
},
101
106
},
102
107
diff = {
Original file line number Diff line number Diff line change @@ -121,9 +121,10 @@ function M.create()
121
121
end
122
122
end )
123
123
124
- for key , handler in pairs (Config .options .ui .custom_keys ) do
125
- if handler then
126
- self :on_key (key , function ()
124
+ for lhs , rhs in pairs (Config .options .ui .custom_keys ) do
125
+ if rhs then
126
+ local handler = type (rhs ) == " table" and rhs [1 ] or rhs
127
+ self :on_key (lhs , function ()
127
128
local plugin = self .render :get_plugin ()
128
129
if plugin then
129
130
handler (plugin )
Original file line number Diff line number Diff line change @@ -209,6 +209,14 @@ function M:help()
209
209
self :append (" " .. (mode .desc_plugin or mode .desc )):nl ()
210
210
end
211
211
end
212
+ for lhs , rhs in pairs (Config .options .ui .custom_keys ) do
213
+ if type (rhs ) == " table" and rhs .desc then
214
+ self :append (" - " , " LazySpecial" , { indent = 2 })
215
+ self :append (" Custom key " , " Title" )
216
+ self :append (lhs , " LazyProp" )
217
+ self :append (" " .. rhs .desc ):nl ()
218
+ end
219
+ end
212
220
end
213
221
214
222
function M :progressbar ()
You can’t perform that action at this time.
0 commit comments