This is very useful for integration with which-key. By default, which-key would describe a mapping with the function call - e.g. require("trouble").action("open_vsplit"), which is not too bad to read, but often truncated to e.g. require("trouble").action("op. With this patch, the which-key description reads Trouble open_vsplit instead.
Before:
$ ➜ End of line <C-K> ➜ Switch Window up b ➜ Previous word m ➜ require("trouble").action("to … > ➜ +Indent right
% ➜ Matching character: '()', '{} … <C-L> ➜ Switch Window right e ➜ Next end of word o ➜ require("trouble").action("ju … [ ➜ +Previous...
& ➜ Nvim builtin <C-N> ➜ Nvimtree Toggle window F ➜ Move to previous char P ➜ require("trouble").action("to … ] ➜ +Next...
0 ➜ Start of line <C-S> ➜ File Save f ➜ Move to next char p ➜ require("trouble").action("pr … <c-w> ➜ +window
; ➜ CMD enter command mode <C-T> ➜ require("trouble").action("op … G ➜ Last line q ➜ require("trouble").action("cl … <leader> ➜ +prefix
? ➜ require("trouble").action("he … <C-V> ➜ require("trouble").action("op … H ➜ Home line of window (top) r ➜ require("trouble").action("re … c ➜ +Change
^ ➜ Start of line (non-blank) <C-X> ➜ require("trouble").action("op … h ➜ Left s ➜ require("trouble").action("sw … d ➜ +Delete
{ ➜ Previous empty line <CR> ➜ require("trouble").action("ju … j ➜ Down t ➜ Move before next char g ➜ +Goto...
} ➜ Next empty line <M-h> ➜ Terminal New horizontal term k ➜ Up T ➜ Move before previous char v ➜ +Visual Character Mode
<2-LeftMouse> ➜ require("trouble").action("ju … <M-i> ➜ Terminal Toggle Floating term K ➜ require("trouble").action("ho … w ➜ Next word y ➜ +Yank (copy)
<C-C> ➜ File Copy whole <M-v> ➜ Terminal Toggleable vertical … l ➜ Right Y ➜ Nvim builtin z ➜ +Fold
<C-H> ➜ Switch Window left <S-Tab> ➜ Buffer Goto prev L ➜ Last line of window ! ➜ +Filter through external prog …
<C-J> ➜ Switch Window down <Tab> ➜ Buffer Goto next M ➜ Middle line of window < ➜ +Indent left
After:
$ ➜ End of line <C-K> ➜ Switch Window up b ➜ Previous word m ➜ Trouble toggle_mode > ➜ +Indent right
% ➜ Matching character: '()', '{} … <C-L> ➜ Switch Window right e ➜ Next end of word o ➜ Trouble jump_close [ ➜ +Previous...
& ➜ Nvim builtin <C-N> ➜ Nvimtree Toggle window f ➜ Move to next char p ➜ Trouble preview ] ➜ +Next...
0 ➜ Start of line <C-S> ➜ File Save F ➜ Move to previous char P ➜ Trouble toggle_preview <c-w> ➜ +window
; ➜ CMD enter command mode <C-T> ➜ Trouble open_tab G ➜ Last line q ➜ Trouble close <leader> ➜ +prefix
? ➜ Trouble help <C-V> ➜ Trouble open_vsplit h ➜ Left r ➜ Trouble refresh c ➜ +Change
^ ➜ Start of line (non-blank) <C-X> ➜ Trouble open_split H ➜ Home line of window (top) s ➜ Trouble switch_severity d ➜ +Delete
{ ➜ Previous empty line <CR> ➜ Trouble jump j ➜ Down t ➜ Move before next char g ➜ +Goto...
} ➜ Next empty line <M-h> ➜ Terminal New horizontal term K ➜ Trouble hover T ➜ Move before previous char v ➜ +Visual Character Mode
<2-LeftMouse> ➜ Trouble jump <M-i> ➜ Terminal Toggle Floating term k ➜ Up w ➜ Next word y ➜ +Yank (copy)
<C-C> ➜ File Copy whole <M-v> ➜ Terminal Toggleable vertical … l ➜ Right Y ➜ Nvim builtin z ➜ +Fold
<C-H> ➜ Switch Window left <S-Tab> ➜ Buffer Goto prev L ➜ Last line of window ! ➜ +Filter through external prog …
<C-J> ➜ Switch Window down <Tab> ➜ Trouble jump M ➜ Middle line of window < ➜ +Indent left
This is very useful for integration with which-key. By default, which-key would describe a mapping with the function call - e.g.
require("trouble").action("open_vsplit")
, which is not too bad to read, but often truncated to e.g.require("trouble").action("op
. With this patch, the which-key description readsTrouble open_vsplit
instead.Before:
After: