ervandew/screen — pull request #14 by guns (2012-01-14 13:46:43+00:00)
Title: Improved tmux 1.5 integration; no more window renaming

Hello again,

Since I've been using screen.vim daily for Clojure coding in the past
weeks, I decided to implement a solution for the tmux window-switching
problem that does not involve setting the window titles.

Quick testing shows that sending from vim -> shell works no matter where
vim or the shell is located, and continues to work if you move both of
them to new locations. I don't use MacVim regularly, but the external
Terminal.app integration also seems to work quite well.

The patch header is below, but I should mention here that the
window-switching does not work in tmux 1.4 and below. It would be easy
to re-add the window-renaming solution for older tmux versions if it's
important to you (so please let me know). However, older tmux versions
still work if the user is careful not switch windows or re-arrange the
shell pane.

Cheers,
Sung

---

Currently, screen.vim uses a magic window title to determine which
window contains the shell pane. This is fragile, mildly annoying, and
also not necessary in Tmux 1.5 (released July 2011).

`tmux list-panes` gained an `-a` flag in the latest version, which lists
all windows along with their unique pane ids. This list can be grepped
to determine the window index of a pane if the unique pane id is known.

First we remove or noop all instances in which we would have set a tmux
window title. Then, we extract and consolidate all calls to select-pane
or select-window into a new method s:screenTmux:focusPane() [1], which
implements the new behavior.

This commit breaks compatibility with tmux 1.4.

[1]: I did not overload s:screenTmux:focus(), because that would have
violated the arity parity with s:screenGnuScreen:focus()