diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-01-25 21:33:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-01-25 21:33:39 +0000 |
commit | 1e5a94fdb5e9fd50ed0d5c5b0a404fa8dc661060 (patch) | |
tree | 5de884941e3781e163794c543f77a8e598f081d8 | |
parent | 75e13c89776b103172ed5813f2198a2b75e3503f (diff) |
Top/bottom of history mode keys, diff from Micah Cowan, tweaked by me.
-rw-r--r-- | mode-key.c | 10 | ||||
-rw-r--r-- | tmux.1 | 4 | ||||
-rw-r--r-- | tmux.h | 2 | ||||
-rw-r--r-- | window-copy.c | 14 |
4 files changed, 27 insertions, 3 deletions
@@ -84,6 +84,8 @@ struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_DOWN, "cursor-down" }, { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, { MODEKEYCOPY_GOTOLINE, "goto-line" }, + { MODEKEYCOPY_HISTORYBOTTOM, "history-bottom" }, + { MODEKEYCOPY_HISTORYTOP, "history-top" }, { MODEKEYCOPY_LEFT, "cursor-left" }, { MODEKEYCOPY_MIDDLELINE, "middle-line" }, { MODEKEYCOPY_NEXTPAGE, "page-down" }, @@ -116,13 +118,13 @@ const struct mode_key_entry mode_key_vi_edit[] = { { '$', 1, MODEKEYEDIT_ENDOFLINE }, { '0', 1, MODEKEYEDIT_STARTOFLINE }, - { 'd', 1, MODEKEYEDIT_DELETELINE }, { 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE }, { '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL }, { '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE }, { '\r', 1, MODEKEYEDIT_ENTER }, { '^', 1, MODEKEYEDIT_STARTOFLINE }, { 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND }, + { 'd', 1, MODEKEYEDIT_DELETELINE }, { 'h', 1, MODEKEYEDIT_CURSORLEFT }, { 'i', 1, MODEKEYEDIT_SWITCHMODE }, { 'j', 1, MODEKEYEDIT_HISTORYDOWN }, @@ -164,6 +166,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { '0', 0, MODEKEYCOPY_STARTOFLINE }, { ':', 0, MODEKEYCOPY_GOTOLINE }, { '?', 0, MODEKEYCOPY_SEARCHUP }, + { 'G', 0, MODEKEYCOPY_HISTORYBOTTOM }, { 'H', 0, MODEKEYCOPY_TOPLINE }, { 'J', 0, MODEKEYCOPY_SCROLLDOWN }, { 'K', 0, MODEKEYCOPY_SCROLLUP }, @@ -181,6 +184,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { '\r', 0, MODEKEYCOPY_COPYSELECTION }, { '^', 0, MODEKEYCOPY_BACKTOINDENTATION }, { 'b', 0, MODEKEYCOPY_PREVIOUSWORD }, + { 'g', 0, MODEKEYCOPY_HISTORYTOP }, { 'h', 0, MODEKEYCOPY_LEFT }, { 'j', 0, MODEKEYCOPY_DOWN }, { 'k', 0, MODEKEYCOPY_UP }, @@ -254,6 +258,9 @@ struct mode_key_tree mode_key_tree_emacs_choice; /* emacs copy mode keys. */ const struct mode_key_entry mode_key_emacs_copy[] = { { ' ', 0, MODEKEYCOPY_NEXTPAGE }, + { '<' | KEYC_ESCAPE,0, MODEKEYCOPY_HISTORYTOP }, + { '>' | KEYC_ESCAPE, 0, MODEKEYCOPY_HISTORYBOTTOM }, + { 'R' | KEYC_ESCAPE, 0, MODEKEYCOPY_TOPLINE }, { '\000' /* C-Space */, 0, MODEKEYCOPY_STARTSELECTION }, { '\001' /* C-a */, 0, MODEKEYCOPY_STARTOFLINE }, { '\002' /* C-b */, 0, MODEKEYCOPY_LEFT }, @@ -275,7 +282,6 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { '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 }, @@ -538,6 +538,7 @@ The following keys are supported as appropriate for the mode: .Bl -column "FunctionXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent .It Sy "Function" Ta Sy "vi" Ta Sy "emacs" .It Li "Back to indentation" Ta "^" Ta "M-m" +.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" .It Li "Cursor down" Ta "j" Ta "Down" @@ -550,7 +551,7 @@ The following keys are supported as appropriate for the mode: .It Li "Delete entire line" Ta "d" Ta "C-u" .It Li "Delete to end of line" Ta "D" Ta "C-k" .It Li "End of line" Ta "$" Ta "C-e" -.It Li "Goto line" Ta ":" Ta "g" +.It Li "Go to line" Ta ":" Ta "g" .It Li "Half page down" Ta "C-d" Ta "M-Down" .It Li "Half page up" Ta "C-u" Ta "M-Up" .It Li "Next page" Ta "C-f" Ta "Page down" @@ -566,6 +567,7 @@ The following keys are supported as appropriate for the mode: .It Li "Search forward" Ta "/" Ta "C-s" .It Li "Start of line" Ta "0" Ta "C-a" .It Li "Start selection" Ta "Space" Ta "C-Space" +.It Li "Top of history" Ta "g" Ta "M->" .It Li "Transpose chars" Ta "" Ta "C-t" .El .Pp @@ -455,6 +455,8 @@ enum mode_key_cmd { MODEKEYCOPY_GOTOLINE, MODEKEYCOPY_HALFPAGEDOWN, MODEKEYCOPY_HALFPAGEUP, + MODEKEYCOPY_HISTORYBOTTOM, + MODEKEYCOPY_HISTORYTOP, MODEKEYCOPY_LEFT, MODEKEYCOPY_MIDDLELINE, MODEKEYCOPY_NEXTPAGE, diff --git a/window-copy.c b/window-copy.c index 3b170a9d..db464646 100644 --- a/window-copy.c +++ b/window-copy.c @@ -296,6 +296,20 @@ 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_HISTORYTOP: + data->cx = 0; + data->cy = 0; + data->oy = screen_hsize(&wp->base); + window_copy_update_selection(wp); + window_copy_redraw_screen(wp); + break; + case MODEKEYCOPY_HISTORYBOTTOM: + data->cx = 0; + data->cy = screen_size_y(s) - 1; + data->oy = 0; + window_copy_update_selection(wp); + window_copy_redraw_screen(wp); + break; case MODEKEYCOPY_STARTSELECTION: window_copy_start_selection(wp); window_copy_redraw_screen(wp); |