summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/key-bindings.c4
-rw-r--r--usr.bin/tmux/tmux.15
-rw-r--r--usr.bin/tmux/window-copy.c18
3 files changed, 23 insertions, 4 deletions
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index e0fb4d494c9..fcaf5de0e32 100644
--- a/usr.bin/tmux/key-bindings.c
+++ b/usr.bin/tmux/key-bindings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-bindings.c,v 1.141 2021/08/27 17:25:55 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.142 2022/02/03 07:26:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -492,6 +492,7 @@ key_bindings_init(void)
"bind -Tcopy-mode \\; { send -X jump-again }",
"bind -Tcopy-mode F { command-prompt -1p'(jump backward)' { send -X jump-backward '%%' } }",
"bind -Tcopy-mode N { send -X search-reverse }",
+ "bind -Tcopy-mode P { send -X toggle-position }",
"bind -Tcopy-mode R { send -X rectangle-toggle }",
"bind -Tcopy-mode T { command-prompt -1p'(jump to backward)' { send -X jump-to-backward '%%' } }",
"bind -Tcopy-mode X { send -X set-mark }",
@@ -588,6 +589,7 @@ key_bindings_init(void)
"bind -Tcopy-mode-vi L { send -X bottom-line }",
"bind -Tcopy-mode-vi M { send -X middle-line }",
"bind -Tcopy-mode-vi N { send -X search-reverse }",
+ "bind -Tcopy-mode-vi P { send -X toggle-position }",
"bind -Tcopy-mode-vi T { command-prompt -1p'(jump to backward)' { send -X jump-to-backward '%%' } }",
"bind -Tcopy-mode-vi V { send -X select-line }",
"bind -Tcopy-mode-vi W { send -X next-space }",
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 7377829182c..c011edd25ca 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.875 2022/02/01 14:46:41 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.876 2022/02/03 07:26:43 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 1 2022 $
+.Dd $Mdocdate: February 3 2022 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -1773,6 +1773,7 @@ The following commands are supported in copy mode:
.It Li "set-mark" Ta "X" Ta "X"
.It Li "start-of-line" Ta "0" Ta "C-a"
.It Li "stop-selection" Ta "" Ta ""
+.It Li "toggle-position" Ta "P" Ta "P"
.It Li "top-line" Ta "H" Ta "M-R"
.El
.Pp
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index c6e42c861a6..416d62c3824 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.332 2021/12/20 09:02:12 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.333 2022/02/03 07:26:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1273,6 +1273,16 @@ window_copy_cmd_halfpage_up(struct window_copy_cmd_state *cs)
}
static enum window_copy_cmd_action
+window_copy_cmd_toggle_position(struct window_copy_cmd_state *cs)
+{
+ struct window_mode_entry *wme = cs->wme;
+ struct window_copy_mode_data *data = wme->data;
+
+ data->hide_position = !data->hide_position;
+ return (WINDOW_COPY_CMD_REDRAW);
+}
+
+static enum window_copy_cmd_action
window_copy_cmd_history_bottom(struct window_copy_cmd_state *cs)
{
struct window_mode_entry *wme = cs->wme;
@@ -2817,6 +2827,12 @@ static const struct {
.clear = WINDOW_COPY_CMD_CLEAR_ALWAYS,
.f = window_copy_cmd_stop_selection
},
+ { .command = "toggle-position",
+ .minargs = 0,
+ .maxargs = 0,
+ .clear = WINDOW_COPY_CMD_CLEAR_NEVER,
+ .f = window_copy_cmd_toggle_position
+ },
{ .command = "top-line",
.minargs = 0,
.maxargs = 0,