Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop current running process in runner #79

Closed
giovannibenussi opened this issue Sep 21, 2017 · 6 comments · Fixed by #98
Closed

Stop current running process in runner #79

giovannibenussi opened this issue Sep 21, 2017 · 6 comments · Fixed by #98

Comments

@giovannibenussi
Copy link

giovannibenussi commented Sep 21, 2017

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)

@christoomey
Copy link
Owner

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!

@giovannibenussi
Copy link
Author

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!

@christoomey
Copy link
Owner

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!

@giovannibenussi
Copy link
Author

That's very nice, I like that mapping!
This will make my work with vim and tmux easier!

Thanks a lot @christoomey! :)

@mbrinkme
Copy link

Thanks @christoomey! It's very well and improves my workflow!

@tmm
Copy link
Contributor

tmm commented May 30, 2020

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants