gioele / vim-autoswap

Please Vim, stop with these swap file messages. Just switch to the correct window!
Creative Commons Zero v1.0 Universal
115 stars 25 forks source link

Add support for using tmux panes for focusing rather than windows #5

Closed lutostag closed 8 years ago

lutostag commented 9 years ago

Autoswap to tmux pane with the file open. (works for any window/pane in the same tmux session) I haven't tested it on OSX nor with gvim, but tmux 1.9 with vim 7.4.273 works great.

Might need to make AS_DetectActiveWindow_Tmux a little clearer and AS_RunningTmux a bit more robust. But works for me.

lutostag commented 9 years ago

As far as multiple tmux sessions in different terminals, it's definitely possible but not in my workflow. I will take a crack at it a bit later this week. Just want to make sure I am on the right track (this is my first real foray into vimscript).

I broke the subshells into different variables as suggested, definitely makes it a bit more readable. Thanks for the suggestion -- unfortunately it was hard to strip the trailing newline from the system return values, if you have thoughts on that front I would appreciate it. (http://vi.stackexchange.com/questions/2867/how-do-you-chomp-a-string-in-vim has one of the methods I went with -- although it seems it may not work cleanly on osx/windows).

gioele commented 9 years ago

Hi @lutostag, I have merged your PR and added an additional configuration option in the lutostag-tmux branch, could you please try it out and see if it works fine in your tmux setup?

lutostag commented 9 years ago

Works for me, with one extra change (also check that the g:autoswap_detect_tmux is set to one before switching windows -- although may be a bit cleaner to have that check in AS_RunningTmux instead, up to you). Change in https://github.com/lutostag/vim-autoswap/tree/lutostag-tmux. Thanks for being an awesome maintainer. Love it!