diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-13 13:45:57 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-13 13:45:57 +0000 |
commit | 11a206aa48af166713facd1a20b777f142135a11 (patch) | |
tree | edb0f7248e22e738ba9b2cef786d6bfd815fb3e0 /usr.bin/tmux | |
parent | 425c25a1fad20be0bcdd4825c0ad514513d698aa (diff) |
Add mode keys to move the cursor to the top, middle and bottom of the screen.
H/M/L in vi mode and M-R/M-r in emacs (bottom of screen not bound in emacs).
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/mode-key.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 5 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 20 |
4 files changed, 38 insertions, 6 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index 7259a03acbb..9cbc1389ce9 100644 --- a/usr.bin/tmux/mode-key.c +++ b/usr.bin/tmux/mode-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-key.c,v 1.22 2009/10/07 15:58:40 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.23 2009/10/13 13:45:56 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -77,6 +77,7 @@ struct mode_key_cmdstr mode_key_cmdstr_choice[] = { /* Copy keys command strings. */ struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" }, + { MODEKEYCOPY_BOTTOMLINE, "bottom-line" }, { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_CLEARSELECTION, "clear-selection" }, { MODEKEYCOPY_COPYSELECTION, "copy-selection" }, @@ -84,6 +85,7 @@ struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, { MODEKEYCOPY_GOTOLINE, "goto-line" }, { MODEKEYCOPY_LEFT, "cursor-left" }, + { MODEKEYCOPY_MIDDLELINE, "middle-line" }, { MODEKEYCOPY_NEXTPAGE, "page-down" }, { MODEKEYCOPY_NEXTWORD, "next-word" }, { MODEKEYCOPY_PREVIOUSPAGE, "page-up" }, @@ -96,6 +98,7 @@ struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_SEARCHUP, "search-backward" }, { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, + { MODEKEYCOPY_TOPLINE, "top-line" }, { MODEKEYCOPY_UP, "cursor-up" }, { 0, NULL } @@ -161,8 +164,11 @@ const struct mode_key_entry mode_key_vi_copy[] = { { '0', 0, MODEKEYCOPY_STARTOFLINE }, { ':', 0, MODEKEYCOPY_GOTOLINE }, { '?', 0, MODEKEYCOPY_SEARCHUP }, + { 'H', 0, MODEKEYCOPY_TOPLINE }, { 'J', 0, MODEKEYCOPY_SCROLLDOWN }, { 'K', 0, MODEKEYCOPY_SCROLLUP }, + { 'L', 0, MODEKEYCOPY_BOTTOMLINE }, + { 'M', 0, MODEKEYCOPY_MIDDLELINE }, { '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE }, { '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL }, { '\004' /* C-d */, 0, MODEKEYCOPY_HALFPAGEDOWN }, @@ -189,7 +195,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT }, { KEYC_UP | KEYC_CTRL, 0, MODEKEYCOPY_SCROLLUP }, { KEYC_UP, 0, MODEKEYCOPY_UP }, - + { 0, -1, 0 } }; struct mode_key_tree mode_key_tree_vi_copy; @@ -266,6 +272,8 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { 'm' | KEYC_ESCAPE, 0, MODEKEYCOPY_BACKTOINDENTATION }, { 'n', 0, MODEKEYCOPY_SEARCHAGAIN }, { 'q', 0, MODEKEYCOPY_CANCEL }, + { 'r' | KEYC_ESCAPE, 0, MODEKEYCOPY_MIDDLELINE }, + { 'R' | KEYC_ESCAPE, 0, MODEKEYCOPY_TOPLINE }, { 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE }, { 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION }, { KEYC_DOWN | KEYC_CTRL,0, MODEKEYCOPY_SCROLLDOWN }, diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index cb27a8b1288..88ea44311c8 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.109 2009/10/12 11:08:02 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.110 2009/10/13 13:45:56 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -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: October 12 2009 $ +.Dd $Mdocdate: October 13 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -538,6 +538,9 @@ The following keys are supported as appropriate for the mode: .It Li "Start of line" Ta "0" Ta "C-a" .It Li "Start selection" Ta "Space" Ta "C-Space" .It Li "Transpose chars" Ta "" Ta "C-t" +.It Li "Cursor to top line" Ta "H" Ta "M-R" +.It Li "Cursor to middle line" Ta "M" Ta "M-r" +.It Li "Cursor to bottom line" Ta "L" Ta "" .El .Pp These key bindings are defined in a set of named tables: diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index e11be3804c0..3e29ace84be 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.137 2009/10/12 17:19:47 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.138 2009/10/13 13:45:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -397,6 +397,7 @@ enum mode_key_cmd { /* Copy keys. */ MODEKEYCOPY_BACKTOINDENTATION, + MODEKEYCOPY_BOTTOMLINE, MODEKEYCOPY_CANCEL, MODEKEYCOPY_CLEARSELECTION, MODEKEYCOPY_COPYSELECTION, @@ -406,6 +407,7 @@ enum mode_key_cmd { MODEKEYCOPY_HALFPAGEDOWN, MODEKEYCOPY_HALFPAGEUP, MODEKEYCOPY_LEFT, + MODEKEYCOPY_MIDDLELINE, MODEKEYCOPY_NEXTPAGE, MODEKEYCOPY_NEXTWORD, MODEKEYCOPY_PREVIOUSPAGE, @@ -418,6 +420,7 @@ enum mode_key_cmd { MODEKEYCOPY_SEARCHUP, MODEKEYCOPY_STARTOFLINE, MODEKEYCOPY_STARTSELECTION, + MODEKEYCOPY_TOPLINE, MODEKEYCOPY_UP, }; diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 502af6073f3..3f5fbbe7895 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.29 2009/10/11 07:01:10 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.30 2009/10/13 13:45:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -278,6 +278,24 @@ window_copy_key(struct window_pane *wp, struct client *c, int key) window_copy_update_selection(wp); window_copy_redraw_screen(wp); break; + case MODEKEYCOPY_TOPLINE: + data->cx = 0; + data->cy = 0; + window_copy_update_selection(wp); + window_copy_redraw_screen(wp); + break; + case MODEKEYCOPY_MIDDLELINE: + data->cx = 0; + data->cy = (screen_size_y(s) - 1) / 2; + window_copy_update_selection(wp); + window_copy_redraw_screen(wp); + break; + case MODEKEYCOPY_BOTTOMLINE: + data->cx = 0; + data->cy = screen_size_y(s) - 1; + window_copy_update_selection(wp); + window_copy_redraw_screen(wp); + break; case MODEKEYCOPY_STARTSELECTION: window_copy_start_selection(wp); window_copy_redraw_screen(wp); |