preservim / vimux

easily interact with tmux from vim
MIT License
2.19k stars 158 forks source link

Vimux doesn't accept all tmux pane identifiers #206

Closed camgraff closed 1 year ago

camgraff commented 2 years ago

In my config I have logic to dynamically select which pane to run a command in by setting g:VimuxRunnerIndex prior to calling VimuxRunCommand. However, if I set g:VimuxRunnerIndex to "{down-of}", Vimux will not run the command in the correct pane due to this line which, as far as I can tell, is supposed to check if the pane exists. The issue is that s:hasRunner doesn't account for these special pane identifiers.

alerque commented 2 years ago

Understood. I would be happy to accept a PR that fixes this bug if you (or anyone else reading this) has any idea how to make it happen.

mvanderkamp commented 2 years ago

The issue as I see it is that g:VimuxRunnerIndex is really only intended for internal use, as a way of consistently tracking the runner pane even if it is moved around. I'm not sure that broadcasting that this variable exists and allowing something like "{down-of}" inside it makes sense in that context.

It sounds like what's wanted here is an option to supply the exact target-pane search string to use when connecting a runner.

mvanderkamp commented 2 years ago

That said, looks like these search strings have been available since tmux 2.2. I think we should not only support them, but use them for the "nearest index" search instead of the current search approach (which doesn't really find the nearest, exactly).

Also, might make sense to rename the internal functions to make it more clear that we are actually looking at the pane/window id, not merely its index.