diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-18 07:08:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-18 07:08:26 +0000 |
commit | c828c2f3665d1caed443816a066e3ac81b08ea83 (patch) | |
tree | 9ba82975cebbd40172e3c72634a3c3e6ab0bfdf5 /mode-key.c | |
parent | e7cd547457e40dce8c05c37c358c414d36bac54d (diff) |
Add (naive) searching and goto line in copy mode. Searching is C-r and C-s with
emacs keys, / and ? with vi; n repeats the search again with either key
set. All searching wraps the top/bottom. Goto line is g for both emacs and vi.
The search prompts don't have full line editing, just simple append and delete
characters.
Also sort the mode keys list in tmux.1.
Diffstat (limited to 'mode-key.c')
-rw-r--r-- | mode-key.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -74,18 +74,22 @@ struct mode_key_cmdstr mode_key_cmdstr_choice[] = { /* Copy keys command strings. */ struct mode_key_cmdstr mode_key_cmdstr_copy[] = { - { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" }, + { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_CLEARSELECTION, "clear-selection" }, { MODEKEYCOPY_COPYSELECTION, "copy-selection" }, { MODEKEYCOPY_DOWN, "cursor-down" }, { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, + { MODEKEYCOPY_GOTOLINE, "goto-line" }, { MODEKEYCOPY_LEFT, "cursor-left" }, { MODEKEYCOPY_NEXTPAGE, "page-down" }, { MODEKEYCOPY_NEXTWORD, "next-word" }, { MODEKEYCOPY_PREVIOUSPAGE, "page-up" }, { MODEKEYCOPY_PREVIOUSWORD, "previous-word" }, { MODEKEYCOPY_RIGHT, "cursor-right" }, + { MODEKEYCOPY_SEARCHAGAIN, "search-again" }, + { MODEKEYCOPY_SEARCHDOWN, "search-forward" }, + { MODEKEYCOPY_SEARCHUP, "search-backward" }, { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, { MODEKEYCOPY_UP, "cursor-up" }, @@ -148,7 +152,9 @@ struct mode_key_tree mode_key_tree_vi_choice; const struct mode_key_entry mode_key_vi_copy[] = { { ' ', 0, MODEKEYCOPY_STARTSELECTION }, { '$', 0, MODEKEYCOPY_ENDOFLINE }, + { '/', 0, MODEKEYCOPY_SEARCHUP }, { '0', 0, MODEKEYCOPY_STARTOFLINE }, + { '?', 0, MODEKEYCOPY_SEARCHDOWN }, { '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE }, { '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL }, { '\004' /* C-d */, 0, MODEKEYCOPY_HALFPAGEDOWN }, @@ -159,10 +165,12 @@ const struct mode_key_entry mode_key_vi_copy[] = { { '\r', 0, MODEKEYCOPY_COPYSELECTION }, { '^', 0, MODEKEYCOPY_BACKTOINDENTATION }, { 'b', 0, MODEKEYCOPY_PREVIOUSWORD }, + { 'g', 0, MODEKEYCOPY_GOTOLINE }, { 'h', 0, MODEKEYCOPY_LEFT }, { 'j', 0, MODEKEYCOPY_DOWN }, { 'k', 0, MODEKEYCOPY_UP }, { 'l', 0, MODEKEYCOPY_RIGHT }, + { 'n', 0, MODEKEYCOPY_SEARCHAGAIN }, { 'q', 0, MODEKEYCOPY_CANCEL }, { 'w', 0, MODEKEYCOPY_NEXTWORD }, { KEYC_BSPACE, 0, MODEKEYCOPY_LEFT }, @@ -232,12 +240,16 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { '\007' /* C-g */, 0, MODEKEYCOPY_CLEARSELECTION }, { '\016' /* C-n */, 0, MODEKEYCOPY_DOWN }, { '\020' /* C-p */, 0, MODEKEYCOPY_UP }, + { '\022' /* C-r */, 0, MODEKEYCOPY_SEARCHUP }, + { '\023' /* C-s */, 0, MODEKEYCOPY_SEARCHDOWN }, { '\026' /* C-v */, 0, MODEKEYCOPY_NEXTPAGE }, { '\027' /* C-w */, 0, MODEKEYCOPY_COPYSELECTION }, { '\033' /* Escape */, 0, MODEKEYCOPY_CANCEL }, { 'b' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSWORD }, { 'f' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTWORD }, + { 'g', 0, MODEKEYCOPY_GOTOLINE }, { 'm' | KEYC_ESCAPE, 0, MODEKEYCOPY_BACKTOINDENTATION }, + { 'n', 0, MODEKEYCOPY_SEARCHAGAIN }, { 'q', 0, MODEKEYCOPY_CANCEL }, { 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE }, { 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION }, |