preservim / vimux

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

Check tmux binary availability at startup. #146

Closed lyuts closed 7 years ago

lyuts commented 7 years ago

Updated the plugin to:

I noticed that you get a lot of issues opened stating that vimux doesn't work at all, i.e. any attempt to send text to a tmux pane is basically a noop, rendring the plugin not working/usable. I came across several dev env setups where tmux is not on the PATH and/or have alias for tmux. This contributes to this class of problems. While proposed patch doesn't solve all of those, it at least address this one particular env setup approach and will explicitly warn the user.

leostera commented 7 years ago

Hello @lyuts, if you check here you'll see that the _VimuxTmux function is doing exactly this.

It uses _VimuxOption to check for the global g:VimuxTmuxCommand and if it's not set, fallbacks to just tmux.

The check, however, is a good addition! So maybe we can extract the command with fallback and reuse it for the check? Something like:

if !executable(_VimuxTmuxCmd())
  " blow up with a useful error message
  finish
endif

" ....

function! _VimuxTmuxCmd()
  return _VimuxOption("g:VimuxTmuxCommand", "tmux")
endfunction
lyuts commented 7 years ago

I did the proposed change, but looks like i messed up the branch i used to work on, so now 3 commits got in between mine.

lyuts commented 7 years ago

Looks like there is no way to change source branch of a pull request, only target branch can be changed. Replacing this PR with #155 to avoid confusion with commits.