Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Improved tmux 1.5 integration; no more window renaming #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

guns
Copy link
Contributor

@guns guns commented Jan 14, 2012

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()

@ervandew
Copy link
Owner

The changes look good, but I don't want to exclude support for tmux 1.4 (some people still have 1.3). When I have time (or if someone gets the motivation to do it), I'll probably end up updating the code to check the tmux version and handle it accordingly.

Thanks for the patch. I'm sure I'll incorporate them one way or another at some point.

guns added 3 commits March 10, 2012 16:10
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()
POSIX BRE syntax. `grep -w` is not in the standard unfortunately.
@weynhamz
Copy link

Hey, @guns, I am annoyed by the changed window title too, this patch seems nice, is it possible to add support for tmux 1.4 so that @ervandew could merge this PR into the master?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants