From 3dbacbb62b033c04185fb87da5b0622f0aafee86 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 13 May 2014 07:34:35 +0000 Subject: Add support for named buffers. If you don't name a buffer, things work much as before - buffers are automatically named "buffer0000", "buffer0001" and so on and ordered as a stack. Buffers can be named explicitly when creating ("loadb -b foo" etc) or renamed ("setb -b buffer0000 -n foo"). If buffers are named explicitly, they are not deleted when buffer-limit is reached. Diff from J Raynor. --- tmux.1 | 63 +++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 20 deletions(-) (limited to 'tmux.1') diff --git a/tmux.1 b/tmux.1 index 44e69f6e..ae6190e4 100644 --- a/tmux.1 +++ b/tmux.1 @@ -930,9 +930,6 @@ in emacs mode, and .Ql 10w in vi. .Pp -When copying the selection, the repeat count indicates the buffer index to -replace, if used. -.Pp Mode key bindings are defined in a set of named tables: .Em vi-edit and @@ -1090,7 +1087,7 @@ but a different format may be specified with .Fl F . .It Xo Ic capture-pane .Op Fl aepPq -.Op Fl b Ar buffer-index +.Op Fl b Ar buffer-name .Op Fl E Ar end-line .Op Fl S Ar start-line .Op Fl t Ar target-pane @@ -3366,19 +3363,40 @@ is given, otherwise the active pane for the session attached to .El .Sh BUFFERS .Nm -maintains a stack of +maintains a set of named .Em paste buffers . -Up to the value of the +Each buffer may be either explicitly or automatically named. +Explicitly named buffers are named when created with the +.Ic set-buffer +or +.Ic load-buffer +commands, or by renaming an automatically named buffer with +.Ic set-buffer +.Fl n . +Automatically named buffers are given a name such as +.Ql buffer0001 , +.Ql buffer0002 +and so on. +When the +.Ic buffer-limit +option is reached, the oldest automatically named buffer is deleted. +Explicitly named are not subject to .Ic buffer-limit -option are kept; when a new buffer is added, the buffer at the bottom of the -stack is removed. +and may be deleted with +.Ic delete-buffer +command. +.Pp Buffers may be added using .Ic copy-mode or the .Ic set-buffer -command, and pasted into a window using the +and +.Ic load-buffer +commands, and pasted into a window using the .Ic paste-buffer command. +If a buffer command is used and no buffer is specified, the most +recently added automatically named buffer is assumed. .Pp A configurable history buffer is also maintained for each window. By default, up to 2000 lines are kept; this can be altered with the @@ -3399,7 +3417,7 @@ Put a window into buffer choice mode, where a buffer may be chosen interactively from a list. After a buffer is selected, .Ql %% -is replaced by the buffer index in +is replaced by the buffer name in .Ar template and the result executed as a command. If @@ -3414,11 +3432,11 @@ This command works only if at least one client is attached. .It Ic clear-history Op Fl t Ar target-pane .D1 (alias: Ic clearhist ) Remove and free the history for the specified pane. -.It Ic delete-buffer Op Fl b Ar buffer-index +.It Ic delete-buffer Op Fl b Ar buffer-name .D1 (alias: Ic deleteb ) -Delete the buffer at -.Ar buffer-index , -or the top buffer if not specified. +Delete the buffer named +.Ar buffer-name , +or the most recently added automatically named buffer if not specified. .It Xo Ic list-buffers .Op Fl F Ar format .Xc @@ -3430,7 +3448,7 @@ flag, see the .Sx FORMATS section. .It Xo Ic load-buffer -.Op Fl b Ar buffer-index +.Op Fl b Ar buffer-name .Ar path .Xc .D1 (alias: Ic loadb ) @@ -3438,7 +3456,7 @@ Load the contents of the specified paste buffer from .Ar path . .It Xo Ic paste-buffer .Op Fl dpr -.Op Fl b Ar buffer-index +.Op Fl b Ar buffer-name .Op Fl s Ar separator .Op Fl t Ar target-pane .Xc @@ -3447,7 +3465,7 @@ Insert the contents of a paste buffer into the specified pane. If not specified, paste into the current one. With .Fl d , -also delete the paste buffer from the stack. +also delete the paste buffer. When output, any linefeed (LF) characters in the paste buffer are replaced with a separator, by default carriage return (CR). A custom separator may be specified using the @@ -3462,7 +3480,7 @@ is specified, paste bracket control codes are inserted around the buffer if the application has requested bracketed paste mode. .It Xo Ic save-buffer .Op Fl a -.Op Fl b Ar buffer-index +.Op Fl b Ar buffer-name .Ar path .Xc .D1 (alias: Ic saveb ) @@ -3473,7 +3491,8 @@ The option appends to rather than overwriting the file. .It Xo Ic set-buffer .Op Fl a -.Op Fl b Ar buffer-index +.Op Fl b Ar buffer-name +.Op Fl n Ar new-buffer-name .Ar data .Xc .D1 (alias: Ic setb ) @@ -3482,8 +3501,12 @@ Set the contents of the specified buffer to The .Fl a option appends to rather than overwriting the buffer. +The +.Fl n +option renames the buffer to +.Ar new-buffer-name . .It Xo Ic show-buffer -.Op Fl b Ar buffer-index +.Op Fl b Ar buffer-name .Xc .D1 (alias: Ic showb ) Display the contents of the specified buffer. -- cgit From b1a06ef22e54e943d733db8dcc98fe60051c93de Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 13 May 2014 07:54:20 +0000 Subject: Add a copy mode key binding to copy to a named buffer. From J Raynor. --- tmux.1 | 1 + 1 file changed, 1 insertion(+) (limited to 'tmux.1') diff --git a/tmux.1 b/tmux.1 index ae6190e4..397a228b 100644 --- a/tmux.1 +++ b/tmux.1 @@ -849,6 +849,7 @@ The following keys are supported as appropriate for the mode: .It Sy "Function" Ta Sy "vi" Ta Sy "emacs" .It Li "Append selection" Ta "A" Ta "" .It Li "Back to indentation" Ta "^" Ta "M-m" +.It Li "Copy to named buffer" Ta \&" Ta "" .It Li "Bottom of history" Ta "G" Ta "M-<" .It Li "Clear selection" Ta "Escape" Ta "C-g" .It Li "Copy selection" Ta "Enter" Ta "M-w" -- cgit From b3e8d440ed0477e88232c3ba1779c67eafce3a48 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 13 May 2014 08:08:32 +0000 Subject: If multiple arguments are given to new-session, new-window, split-window, respawn-window or respawn-pane, pass them directly to execvp() to help avoid quoting problems. One argument still goes to "sh -c" like before. Requested by many over the years. Patch from J Raynor. --- tmux.1 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'tmux.1') diff --git a/tmux.1 b/tmux.1 index 397a228b..24dde9fa 100644 --- a/tmux.1 +++ b/tmux.1 @@ -478,12 +478,37 @@ It may be used alone to target a pane or the window containing it. arguments are .Xr sh 1 commands. -These must be passed as a single item, which typically means quoting them, for -example: +This may be a single argument passed to the shell, for example: .Bd -literal -offset indent new-window 'vi /etc/passwd' .Ed .Pp +Will run: +.Bd -literal -offset indent +/bin/sh -c 'vi /etc/passwd' +.Ed +.Pp +Additionally, the +.Ic new-window , +.Ic new-session , +.Ic split-window , +.Ic respawn-window +and +.Ic respawn-pane +commands allow +.Ar shell-command +to be given as multiple arguments and executed directly (without +.Ql sh -c ) . +This can avoid issues with shell quoting. +For example: +.Bd -literal -offset indent +$ tmux new-window vi /etc/passwd +.Ed +.Pp +Will run +.Xr vi 1 +directly without invoking the shell. +.Pp .Ar command .Op Ar arguments refers to a -- cgit