-
I do a lot of scripting, and this includes running some commands a lot of times, some of them have very short outputs, which the default view is lovely, but, some of them, like ansible commands over hundreds of servers, have huge outputs, and I would like to choose between a normal execute or a different type, like sending it to split terminal, or a tmux pane/window, and or possible saving the execution output to a file or buffer, I would love to be able to have different keymaps for the above behavior, and have not be able to find how to do that. Thanks :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Unfortunately, every existing solution has a caveat. The best I can propose without having to code something from scratch would be this: it's possible to toggle an alternate configurations on and off, like so:
and bind that to commands (on/off, or even better , an unique command with a pseudo-global switch; A slightly more compact version would have to be a full-fledged function that you would have to put into your (lua) configuration and bind a command/keymap on it. function toggle()
local s = require'sniprun'.config_values
if s.switch_configs == nil then -- the name 'switch_configs' is arbitrary, but choose something that
-- doesn't conflict with a config option
s.switch_configs = "not nil"
s.display = { "Terminal", "VirtualTextErr" }
print("Switched to alternate config")
else
s.display = { "Classic", "VirtualTextOk" }
s.switch_configs = nil
print("Switched to main config")
end
end The other ways of doing that would be to include a
or
I'm currently revamping the display mode system, and I'm planning to add two new display modes (virtual line and file), in addition to being able to filter on 'ok' or 'error'. Though, for now, it's not possible to get the output in a file or a console pane 'natively' (well, there is an API, so everything is possible) |
Beta Was this translation helpful? Give feedback.
Unfortunately, every existing solution has a caveat.
The best I can propose without having to code something from scratch would be this:
it's possible to toggle an alternate configurations on and off, like so:
:lua require('sniprun').setup({ option={"i want", "to change"} })
:lua require('sniprun').setup({ option={"to the old one"} })
and bind that to commands (on/off, or even better , an unique command with a pseudo-global switch; A slightly more compact version would have to be a full-fledged function that you would have to put into your (lua) configuration and bind a command/keymap on it.