christoomey / vim-tmux-runner

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

Runner pane no longer opens after exit? #24

Closed rustygeldmacher closed 9 years ago

rustygeldmacher commented 9 years ago

First off, VTR is awesome, I use it all the time in combo with vim-spec-runner. Thanks!

Was wondering if this is a bug or if I'm just using it wrong, but if I exit the shell from the runner pane, then the next time I try to invoke VTR, it doesn't open and/or recreate the pane for me.

For instance:

Am I doing something wrong?

Thanks!

christoomey commented 9 years ago

Hey @rustygeldmacher, thanks for compliment!

I think what you are describing is the expected, if mediocre, behavior.

Just to confirm, when you say you 'exit the shell from the runner pane', the pane is closing as well, correct? Assuming yes, then the behavior you describe is expected.

Currently VTR has no sense of what panes are open at any given time, it just holds on to a pane index and tries to work against that. If it is your first time interacting with VTR and it doesn't have a runner_pane index saved, it will open a pane, but once it has the index, it will naively continue to use that until you tell it otherwise.

There are two workarounds:

  1. Open a new tmux pane: If you open a new tmux pane to replace the closed one, VTR will blindly use it not knowing anything has changed (assuming it has the same pane index, which will be true if the layout is the same).
  2. Reattach to the pane: There is a command to attach VTR to a pane, :VtrAttachToPane. This will cause tmux to briefly display the pane numbers then ask for the desired index to attach to. You can use this if you alter the layout, or want to attach to a pane opened manually
  3. Fix the code: This one's on me. I have a few issues open around this, specifically https://github.com/christoomey/vim-tmux-runner/issues/20, and plan to make any commands that expect a pane use this smarter logic, but have yet to implement.

Hopefully that clarifies things for you and can get your by. Please let me know if you still have any issues, or if this is workable for you.

rustygeldmacher commented 9 years ago

Hi @christoomey -- thanks for your thoughtful response!

To confirm, I do mean literally typing exit in the VTR pane to close it (it's an OCD/force of habit thing). Your explanation makes perfect sense -- in fact I really should have tried manually re-opening the pane first before asking about it. I've been doing that for the past few days since you posted this and its been working just fine.

Thanks again for the great software!

rusty