Closed giovannibenussi closed 4 years ago
Hi @giovannibenussi, good question!
Unfortunately the current version of the plugin does not support sending SIGINT
(I'm treating this as equivalent to sending the raw key sequence C-c
as I don't know of a way to directly send a signal to tmux pane).
That said, I've wanted behavior like this and similar before, so I pulled together a quick branch to test out a new API. You can check out the branch here: https://github.com/christoomey/vim-tmux-runner/tree/cjt-add-send-raw-command. It introduces two new commands:
VtrSendKeysRaw
- this can be used for any other key sequence like ^D
. This can be run manually with ^C
, but I'm unable to determine how to write a mapping with this command for ^C
. Thus...VtrSendCtrlC
- a specific command for sending ^C
, which can also be used in mappings.Would you mind trying out this branch to see if this works for you? Assuming it works, I'll update the documentation and merge this in.
Thanks!
Hi @christoomey, thanks for your fast answer and solution!
I just try the VtrSendKeysRaw
command and it works as expected using ^C
and ^D
as parameters.
The VtrSendCtrlC
also works as expected!
I don't really understand what do you mean with the mapping for VtrSendKeysRaw
with ^C
. However, I add this to my .vimrc
to map <leader>c
to send VtrSendKeysRaw ^C
to the attached pane:
nnoremap <leader>c :VtrSendKeysRaw ^C<cr>
I try that and it works as expected! That was what you mean?
Regards!
I was trying various version of <C-c>
and using ^V^C to get a literal ^C, which didn't work, but ^C
as the distinct characters works! How nice! I'd prefer to not have to special case it, although I'll likely want to document this mapping so folks won't hit the issue I did.
I'm going to keep this issue open until I merge in the final version, but hopefully the branch is enough to keep you going in the mean time. Thanks!
That's very nice, I like that mapping! This will make my work with vim and tmux easier!
Thanks a lot @christoomey! :)
Thanks @christoomey! It's very well and improves my workflow!
@christoomey love this! need any help getting the branch across the finish line?
Edit: Created PR #98 updating the documentation. Would love to see this merged!
It is possible to send a SIGINT or stop a process that is running in the current attached pane.
This can be useful for example when you're coding something in vim that takes some seconds to finish and you want to execute it directly in an attached pane without leave vim. If you realize that you make a mistake, it can be easier to cancel directly the running process without leave vim.
Currently the process is (starting in vim): move to the attached pane, press ctrl-c, go back to vim.
Also, this can be useful to exit copy mode in the attached pane directly from vim (solves partially #70)