Tmux 1.7 navigation window

I am just updating tmux 1.7, and a new option appears on the man pages for using movew : -r , which says

move-window [-rdk] [-s src-window] [-t dst-window] (alias: movew) This is similar to a window link, except that the window in the src window moves to the dst window. With -r, all windows in the session are renumbered in sequential order, observing the base index option.

If I have 3 windows in a session: 1 2 3 and I try this command from window 1:

 prefix : movew -r -t 4 

he gives an error:

session not found: 4

Does this window 1 move to window 4 and rename windows? I am not trying to move it to a new session, just a new window in the same one.

+4
source share
1 answer

This is not explicitly stated in the documentation, but when you use -r , the -t argument is interpreted as a session specifier, not a window specifier.

Thus, move-window -r -t 4 tells tmux to renumber all windows in the session with the name / corresponding line "4".

It looks like you can accomplish what you want * with two commands (assuming you have base-index set to 1):

 move-window -t 4 ; move-window -r 

You can bind a sequence of commands to a key, but you need to avoid a semicolon (so the second command does not just execute immediately after the initial bind command):

 bind-key : move-window -t 4 \; move-window -r 

In addition, if you usually maintain a β€œhassle-free” sequence of window numbers (for example, you have the renumber-windows option renumber-windows ), you can replace 4 with : and a couple of commands will work for any number (not only 3 or less) : in as the specifier of the destination window means "the first unused window number in the current session" (i.e. 4 if you already have windows 1-3).


* If I understand correctly that you want to convert a set of windows, such as 1: A, 2: B, 3: C to 1: B, 2: C, 3: A (i.e. move window No. 1 ("A ") to the end and renumber them all so that you have 1-3 again instead of 2-4).

+6
source

Source: https://habr.com/ru/post/1439705/


All Articles