christoomey / vim-tmux-runner

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

Runner Pane Index #91

Open redxtech opened 4 years ago

redxtech commented 4 years ago

Hey, I'm wondering if there's currently a way to set a variable to the index of the current runner pane, if it exists.

christoomey commented 4 years ago

The runner pane index is stored in a script local variable, s:runner_pane. It is assigned in a few spots in the plugin code, e.g. here. I'm inclined to keep it private, although I'd be interested to hear the use case you have for wanting to access it (that isn't covered by the existing plugin functionality).

redxtech commented 4 years ago

My use case is using the index to focus the runner pane without having to use a context-based target (such as '{down-of}', as the plane won't always be guaranteed the same relative position). The current focus method will also zoom the pane. While this functionality is probably attainable through unzooming the pane immediately after, but I don't think that's the most reasonable way to do it.

Now that I think about it, implementing a new function or something similar would be better than making the index public.

If you would be willing to accept a pull request with either a new focus function that doesn't zoom, or a new parameter on the current one to disable the zooming (defaulting to current behavior to maintain backwards compatibility) let me know, along with any code style rules you'd like to maintain, and I'll happily send a PR later tonight when I get home. I'd actually quite enjoy doing this (gotta get those hacktoberfest PRs going) so I'd be happy to do this.

redxtech commented 4 years ago

I went ahead and made the PR (#93). Let me know if there's anything that I would need to change for it to be implemented.