mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add ^ and $ special command targets to select lowest and highest
numbered windows, from Raghavendra D Prabhu.
This commit is contained in:
		
							
								
								
									
										4
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								cmd.c
									
									
									
									
									
								
							@@ -863,6 +863,10 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp)
 | 
			
		||||
		wl = s->curw;
 | 
			
		||||
	else if (winptr[0] == '!' && winptr[1] == '\0')
 | 
			
		||||
		wl = TAILQ_FIRST(&s->lastw);
 | 
			
		||||
	else if (winptr[0] == '^' && winptr[1] == '\0')
 | 
			
		||||
		wl = RB_MIN(winlinks, &s->windows);
 | 
			
		||||
	else if (winptr[0] == '$' && winptr[1] == '\0')
 | 
			
		||||
		wl = RB_MAX(winlinks, &s->windows);
 | 
			
		||||
	else if (winptr[0] == '+' || winptr[0] == '-')
 | 
			
		||||
		wl = cmd_find_window_offset(winptr, s, &ambiguous);
 | 
			
		||||
	else
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							@@ -408,11 +408,15 @@ otherwise the current window in
 | 
			
		||||
is chosen.
 | 
			
		||||
The special character
 | 
			
		||||
.Ql \&!
 | 
			
		||||
uses the last (previously current) window, or
 | 
			
		||||
uses the last (previously current) window,
 | 
			
		||||
.Ql ^
 | 
			
		||||
selects the highest numbered window,
 | 
			
		||||
.Ql $
 | 
			
		||||
selects the lowest numbered window, and
 | 
			
		||||
.Ql +
 | 
			
		||||
and
 | 
			
		||||
.Ql -
 | 
			
		||||
are the next window or the previous window by number.
 | 
			
		||||
select the next window or the previous window by number.
 | 
			
		||||
When the argument does not contain a colon,
 | 
			
		||||
.Nm
 | 
			
		||||
first attempts to parse it as window; if that fails, an attempt is made to
 | 
			
		||||
@@ -1126,6 +1130,7 @@ This command works only from inside
 | 
			
		||||
.Ic choose-tree
 | 
			
		||||
.Op Fl s
 | 
			
		||||
.Op Fl w
 | 
			
		||||
.Op Fl u
 | 
			
		||||
.Op Fl b Ar session-template
 | 
			
		||||
.Op Fl c Ar window-template
 | 
			
		||||
.Op Fl S Ar format
 | 
			
		||||
@@ -1151,6 +1156,9 @@ If
 | 
			
		||||
.Fl w
 | 
			
		||||
is given, will show windows.
 | 
			
		||||
If
 | 
			
		||||
.Fl u
 | 
			
		||||
is given, the tree is uncollapsed by default.
 | 
			
		||||
If
 | 
			
		||||
.Fl b
 | 
			
		||||
is given, will override the default session command.
 | 
			
		||||
Note that
 | 
			
		||||
@@ -1639,7 +1647,7 @@ is the same as using the
 | 
			
		||||
.Ic last-pane
 | 
			
		||||
command.
 | 
			
		||||
.It Xo Ic select-window
 | 
			
		||||
.Op Fl lnp
 | 
			
		||||
.Op Fl lnpT
 | 
			
		||||
.Op Fl t Ar target-window
 | 
			
		||||
.Xc
 | 
			
		||||
.D1 (alias: Ic selectw )
 | 
			
		||||
@@ -1655,6 +1663,11 @@ are equivalent to the
 | 
			
		||||
and
 | 
			
		||||
.Ic previous-window
 | 
			
		||||
commands.
 | 
			
		||||
If
 | 
			
		||||
.Fl T
 | 
			
		||||
is given and the selected window is already the current window,
 | 
			
		||||
the command behaves like
 | 
			
		||||
.Ic last-window .
 | 
			
		||||
.It Xo Ic split-window
 | 
			
		||||
.Op Fl dhvP
 | 
			
		||||
.Op Fl c Ar start-directory
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user