@@ -78,7 +78,6 @@ require("noice").setup({
78
78
long_message_to_split = true , -- long messages will be sent to a split
79
79
inc_rename = false , -- enables an input dialog for inc-rename.nvim
80
80
lsp_doc_border = false , -- add a border to hover docs and signature help
81
- cmdline_output_to_split = false , -- send the output of a command you executed in the cmdline to a split
82
81
},
83
82
})
84
83
```
@@ -147,6 +146,13 @@ Check the [wiki](https://github.com/folke/noice.nvim/wiki/Configuration-Recipes)
147
146
-- Icons for completion item kinds (see defaults at noice.config.icons.kinds)
148
147
kind_icons = {}, -- set to `false` to disable icons
149
148
},
149
+ -- default options for require('noice').redirect
150
+ -- see the section on Command Redirection
151
+ --- @type NoiceRouteConfig
152
+ redirect = {
153
+ view = " popup" ,
154
+ filter = { event = " msg_show" },
155
+ },
150
156
-- You can add any custom commands below that will be available with `:Noice command`
151
157
--- @type table<string , NoiceCommand>
152
158
commands = {
@@ -286,7 +292,6 @@ Check the [wiki](https://github.com/folke/noice.nvim/wiki/Configuration-Recipes)
286
292
long_message_to_split = false , -- long messages will be sent to a split
287
293
inc_rename = false , -- enables an input dialog for inc-rename.nvim
288
294
lsp_doc_border = false , -- add a border to hover docs and signature help
289
- cmdline_output_to_split = false , -- send the output of a command you executed in the cmdline to a split
290
295
},
291
296
throttle = 1000 / 30 , -- how frequently does Noice need to check for ui updates? This has no effect when in blocking mode.
292
297
--- @type NoiceConfigViews
@@ -644,6 +649,33 @@ end)
644
649
645
650
> You can add custom commands with ` config.commands `
646
651
652
+ ### ↪️ Command Redirection
653
+
654
+ Sometimes it's useful to redirect the messages generated by a command or function
655
+ to a different view. That can be easily achieved with command redirection.
656
+
657
+ The redirect API can taken an optional ` routes ` parameter, which defaults to ` {config.redirect} ` .
658
+
659
+ ``` lua
660
+ -- redirect ":hi"
661
+ require (" noice" ).redirect (" hi" )
662
+
663
+ -- redirect some function
664
+ require (" noice" ).redirect (function ()
665
+ print (" test" )
666
+ end )
667
+ ```
668
+
669
+ Adding the following keymap, will redirect the active cmdline when pressing ` <S-Enter> ` .
670
+ The cmdline stays open, so you can change the command and execute it again.
671
+ When exiting the cmdline, the popup window will be focused.
672
+
673
+ ``` lua
674
+ vim .keymap .set (" c" , " <S-Enter>" , function ()
675
+ require (" noice" ).redirect (vim .fn .getcmdline ())
676
+ end , { desc = " Redirect Cmdline" })
677
+ ```
678
+
647
679
### Lsp Hover Doc Scrolling
648
680
649
681
``` lua
0 commit comments