christoomey / vim-tmux-runner

Vim and tmux, sittin' in a tree...
MIT License
291 stars 37 forks source link

Runner pane setting invalid after closing runner pane #92

Closed redxtech closed 4 years ago

redxtech commented 4 years ago

Hey, I am wondering if this is intended behavior:

  1. Send command with VtrSendCommandToRunner! <command>: A new runner pane opens (because of the !) and the specified command is run in it.
  2. Navigate to the runner pane and running exit: The runner pane exits.
  3. Send another command with VtrSendCommandToRunner! <command> (once again with the !, expecting a new runner pane to open up, since the old one is gone): No pane opens, and I am shown an error message of VTR: Runner pane setting (2) is invalid. Please reattach.

I am unable to reattach, because when I send that command I see VTR: No detached runner pane.

When I try to open a new pane with VtrOpenRunner nothing happens, and I don't see an error either.

To fix this I have to manually create a new pane with the same pane_index as the runner. I'm wondering if this is intended behavior, or if running VtrSendCommandToRunner! is supposed to open a new runner if the previous one was exited by a means other than VtrKillRunner.

christoomey commented 4 years ago

This is intended functionality, although admittedly not ideal. It's difficult (impossible?) for the plugin to stay perfectly in sync.

That said, I think you can achieve a similar workflow by managing the tmux panes a bit more directly through the plugin:

  1. Send command with VtrSendCommandToRunner! : A new runner pane opens (because of the !) and the specified command is run in it.
  2. Close the pane with :VtrKillRunner command.
  3. Reopen again as needed with :VtrSendCommandToRunner!

If at any point you get out of sync, you can manually open a pane, and then use : VtrAttachToPane to re-attach to the desired pane (the plugin will prompt for the pane to attach to if more than one other pane is open).

:VtrReattachRunner is meant to only be used after running :VtrDetachRunner.

Hopefully, that clarifies and you're able to have a workflow that suits your needs. I'm going to close this now as I don't believe there is any core issue, and I'm hopeful the above provides all you need, but please feel free to comment or reopen if you think I've missed anything.

redxtech commented 4 years ago

Yeah that makes sense. Doesn't avoid the problem of accidentally closing a pane with exit instead of the proper command, but that might just take some getting used to.

Thanks for the info.