add ctrl-left/right and shift-left/right bindings

This commit is contained in:
Daniel Micay 2012-10-02 11:10:59 -04:00
parent ee5486bdad
commit a7e2352596
2 changed files with 26 additions and 4 deletions

View File

@ -45,9 +45,13 @@ COMMAND MODE
+------------------------+-----------------------------------------------------------+
| ``hjkl`` or arrow keys | move cursor left/down/up/right |
+------------------------+-----------------------------------------------------------+
| ``w``/``b`` | forward/backward word |
| ``w`` or shift-right | forward word |
+------------------------+-----------------------------------------------------------+
| ``W``/``B`` | forward/backward WORD (non-whitespace) |
| ``b`` or shift-left | backward word |
+------------------------+-----------------------------------------------------------+
| ``W`` or ctrl-right | forward WORD (non-whitespace) |
+------------------------+-----------------------------------------------------------+
| ``W`` or ctrl-left | backward WORD (non-whitespace) |
+------------------------+-----------------------------------------------------------+
| ``$`` | end-of-line |
+------------------------+-----------------------------------------------------------+

View File

@ -437,11 +437,29 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info)
const guint modifiers = event->state & gtk_accelerator_get_default_mod_mask();
if (info->select.mode != vi_mode::insert) {
if (modifiers == GDK_CONTROL_MASK) {
if (gdk_keyval_to_lower(event->keyval) == GDK_KEY_v) {
switch (gdk_keyval_to_lower(event->keyval)) {
case GDK_KEY_v:
toggle_visual(vte, &info->select, vi_mode::visual_block);
break;
case GDK_KEY_Left:
move_backward_blank_word(vte, &info->select);
break;
case GDK_KEY_Right:
move_forward_blank_word(vte, &info->select);
break;
}
return TRUE;
}
if (modifiers == GDK_SHIFT_MASK) {
switch (event->keyval) {
case GDK_KEY_Left:
move_backward_word(vte, &info->select);
return TRUE;
case GDK_KEY_Right:
move_forward_word(vte, &info->select);
return TRUE;
}
}
switch (event->keyval) {
case GDK_KEY_Escape:
exit_command_mode(info->panel.vte, &info->select);