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;
 | 
							wl = s->curw;
 | 
				
			||||||
	else if (winptr[0] == '!' && winptr[1] == '\0')
 | 
						else if (winptr[0] == '!' && winptr[1] == '\0')
 | 
				
			||||||
		wl = TAILQ_FIRST(&s->lastw);
 | 
							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] == '-')
 | 
						else if (winptr[0] == '+' || winptr[0] == '-')
 | 
				
			||||||
		wl = cmd_find_window_offset(winptr, s, &ambiguous);
 | 
							wl = cmd_find_window_offset(winptr, s, &ambiguous);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							@@ -408,11 +408,15 @@ otherwise the current window in
 | 
				
			|||||||
is chosen.
 | 
					is chosen.
 | 
				
			||||||
The special character
 | 
					The special character
 | 
				
			||||||
.Ql \&!
 | 
					.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 +
 | 
					.Ql +
 | 
				
			||||||
and
 | 
					and
 | 
				
			||||||
.Ql -
 | 
					.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,
 | 
					When the argument does not contain a colon,
 | 
				
			||||||
.Nm
 | 
					.Nm
 | 
				
			||||||
first attempts to parse it as window; if that fails, an attempt is made to
 | 
					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
 | 
					.Ic choose-tree
 | 
				
			||||||
.Op Fl s
 | 
					.Op Fl s
 | 
				
			||||||
.Op Fl w
 | 
					.Op Fl w
 | 
				
			||||||
 | 
					.Op Fl u
 | 
				
			||||||
.Op Fl b Ar session-template
 | 
					.Op Fl b Ar session-template
 | 
				
			||||||
.Op Fl c Ar window-template
 | 
					.Op Fl c Ar window-template
 | 
				
			||||||
.Op Fl S Ar format
 | 
					.Op Fl S Ar format
 | 
				
			||||||
@@ -1151,6 +1156,9 @@ If
 | 
				
			|||||||
.Fl w
 | 
					.Fl w
 | 
				
			||||||
is given, will show windows.
 | 
					is given, will show windows.
 | 
				
			||||||
If
 | 
					If
 | 
				
			||||||
 | 
					.Fl u
 | 
				
			||||||
 | 
					is given, the tree is uncollapsed by default.
 | 
				
			||||||
 | 
					If
 | 
				
			||||||
.Fl b
 | 
					.Fl b
 | 
				
			||||||
is given, will override the default session command.
 | 
					is given, will override the default session command.
 | 
				
			||||||
Note that
 | 
					Note that
 | 
				
			||||||
@@ -1639,7 +1647,7 @@ is the same as using the
 | 
				
			|||||||
.Ic last-pane
 | 
					.Ic last-pane
 | 
				
			||||||
command.
 | 
					command.
 | 
				
			||||||
.It Xo Ic select-window
 | 
					.It Xo Ic select-window
 | 
				
			||||||
.Op Fl lnp
 | 
					.Op Fl lnpT
 | 
				
			||||||
.Op Fl t Ar target-window
 | 
					.Op Fl t Ar target-window
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
.D1 (alias: Ic selectw )
 | 
					.D1 (alias: Ic selectw )
 | 
				
			||||||
@@ -1655,6 +1663,11 @@ are equivalent to the
 | 
				
			|||||||
and
 | 
					and
 | 
				
			||||||
.Ic previous-window
 | 
					.Ic previous-window
 | 
				
			||||||
commands.
 | 
					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
 | 
					.It Xo Ic split-window
 | 
				
			||||||
.Op Fl dhvP
 | 
					.Op Fl dhvP
 | 
				
			||||||
.Op Fl c Ar start-directory
 | 
					.Op Fl c Ar start-directory
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user