diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-01-20 19:10:29 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-01-20 19:10:29 +0000 |
commit | e6519d3e279ba12d44633c3162dd183148aea9f0 (patch) | |
tree | 56962ea4ee174d3d283fc2907a6c3e7e64a44b03 | |
parent | 299a8fd4a3ced13ed678f888aa1b61484a2b613d (diff) | |
download | rtmux-e6519d3e279ba12d44633c3162dd183148aea9f0.tar.gz rtmux-e6519d3e279ba12d44633c3162dd183148aea9f0.tar.bz2 rtmux-e6519d3e279ba12d44633c3162dd183148aea9f0.zip |
Add space movement keys for vi mode in the status line from Ben Boeckel.
-rw-r--r-- | mode-key.c | 6 | ||||
-rw-r--r-- | status.c | 20 | ||||
-rw-r--r-- | tmux.h | 3 |
3 files changed, 25 insertions, 4 deletions
@@ -54,9 +54,12 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = { { MODEKEYEDIT_ENTER, "enter" }, { MODEKEYEDIT_HISTORYDOWN, "history-down" }, { MODEKEYEDIT_HISTORYUP, "history-up" }, + { MODEKEYEDIT_NEXTSPACE, "next-space" }, + { MODEKEYEDIT_NEXTSPACEEND, "next-space-end" }, { MODEKEYEDIT_NEXTWORD, "next-word" }, { MODEKEYEDIT_NEXTWORDEND, "next-word-end" }, { MODEKEYEDIT_PASTE, "paste" }, + { MODEKEYEDIT_PREVIOUSSPACE, "previous-space" }, { MODEKEYEDIT_PREVIOUSWORD, "previous-word" }, { MODEKEYEDIT_STARTOFLINE, "start-of-line" }, { MODEKEYEDIT_SWITCHMODE, "switch-mode" }, @@ -148,7 +151,10 @@ const struct mode_key_entry mode_key_vi_edit[] = { { '$', 1, MODEKEYEDIT_ENDOFLINE }, { '0', 1, MODEKEYEDIT_STARTOFLINE }, + { 'B', 1, MODEKEYEDIT_PREVIOUSSPACE }, { 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE }, + { 'E', 1, MODEKEYEDIT_NEXTSPACEEND }, + { 'W', 1, MODEKEYEDIT_NEXTSPACE }, { 'X', 1, MODEKEYEDIT_BACKSPACE }, { '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL }, { '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE }, @@ -978,7 +978,7 @@ status_prompt_key(struct client *c, int key) struct paste_buffer *pb; char *s, *first, *last, word[64], swapc; const char *histstr; - const char *wsep; + const char *wsep = NULL; u_char ch; size_t size, n, off, idx; @@ -1124,8 +1124,12 @@ status_prompt_key(struct client *c, int key) c->prompt_index = idx; c->flags |= CLIENT_STATUS; break; + case MODEKEYEDIT_NEXTSPACE: + wsep = " "; + /* FALLTHROUGH */ case MODEKEYEDIT_NEXTWORD: - wsep = options_get_string(oo, "word-separators"); + if (wsep == NULL) + wsep = options_get_string(oo, "word-separators"); /* Find a separator. */ while (c->prompt_index != size) { @@ -1143,8 +1147,12 @@ status_prompt_key(struct client *c, int key) c->flags |= CLIENT_STATUS; break; + case MODEKEYEDIT_NEXTSPACEEND: + wsep = " "; + /* FALLTHROUGH */ case MODEKEYEDIT_NEXTWORDEND: - wsep = options_get_string(oo, "word-separators"); + if (wsep == NULL) + wsep = options_get_string(oo, "word-separators"); /* Find a word. */ while (c->prompt_index != size) { @@ -1162,8 +1170,12 @@ status_prompt_key(struct client *c, int key) c->flags |= CLIENT_STATUS; break; + case MODEKEYEDIT_PREVIOUSSPACE: + wsep = " "; + /* FALLTHROUGH */ case MODEKEYEDIT_PREVIOUSWORD: - wsep = options_get_string(oo, "word-separators"); + if (wsep == NULL) + wsep = options_get_string(oo, "word-separators"); /* Find a non-separator. */ while (c->prompt_index != 0) { @@ -447,9 +447,12 @@ enum mode_key_cmd { MODEKEYEDIT_ENTER, MODEKEYEDIT_HISTORYDOWN, MODEKEYEDIT_HISTORYUP, + MODEKEYEDIT_NEXTSPACE, + MODEKEYEDIT_NEXTSPACEEND, MODEKEYEDIT_NEXTWORD, MODEKEYEDIT_NEXTWORDEND, MODEKEYEDIT_PASTE, + MODEKEYEDIT_PREVIOUSSPACE, MODEKEYEDIT_PREVIOUSWORD, MODEKEYEDIT_STARTOFLINE, MODEKEYEDIT_SWITCHMODE, |