vim-tmux-runner icon indicating copy to clipboard operation
vim-tmux-runner copied to clipboard

Use VtrClearSequence to clear buffer history

Open AlexChalk opened this issue 4 years ago • 2 comments
trafficstars

Hi,

I'm trying to use the VtrClearSequence value to issue a tmux clear-history command to my attached pane before sending a command, and it seems like a reasonable use case for a clear command. I want to be able to e.g. run tests and search my buffer for errors without finding results from my previous test run.

I checked the source code, and it seems like the clear sequence is used something like this: !tmux send-keys -t ~pane#~ ~clear-sequence~ ~main-command~. The problem is that executing clear-history like this, e.g. !tmux send-keys -t 1 "tmux clear-history" Enter, well, doesn't clear the history of the pane!

I guess there's something going on with how this command is executed that I don't understand; maybe clear-history doesn't understand the context in which it's been executed when it's run via send-keys? Do you have any ideas about what might be going on?

Thanks for any help you can provide!

AlexChalk avatar Mar 31 '21 14:03 AlexChalk

Hmm, the use case you're describing isn't exactly supported by the current commands, unfortunately. VtrClearSequence is intended to be a key sequence, e.g. Ctrl-l that can be sent to the shell session within a tmux pane, rather than tmux itself. clear-history is a tmux command, so they're operating at a different level.

To support your use case, I think we'd need to add a new VtrClearRunnerHistory command which under the hood executes tmux clear-history -t <runner-pane>. I'd welcome a PR that implements that if you're interested in poking around, but likely won't have time to tackle in the near term.

Hope that helps, or at least clarifies!

christoomey avatar Apr 03 '21 14:04 christoomey

It does, thanks! I'll see how busy I am ;)

AlexChalk avatar Apr 05 '21 14:04 AlexChalk