add ctrl-left/right and shift-left/right bindings
This commit is contained in:
parent
ee5486bdad
commit
a7e2352596
|
@ -45,9 +45,13 @@ COMMAND MODE
|
||||||
+------------------------+-----------------------------------------------------------+
|
+------------------------+-----------------------------------------------------------+
|
||||||
| ``hjkl`` or arrow keys | move cursor left/down/up/right |
|
| ``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 |
|
| ``$`` | end-of-line |
|
||||||
+------------------------+-----------------------------------------------------------+
|
+------------------------+-----------------------------------------------------------+
|
||||||
|
|
20
termite.cc
20
termite.cc
|
@ -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();
|
const guint modifiers = event->state & gtk_accelerator_get_default_mod_mask();
|
||||||
if (info->select.mode != vi_mode::insert) {
|
if (info->select.mode != vi_mode::insert) {
|
||||||
if (modifiers == GDK_CONTROL_MASK) {
|
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);
|
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;
|
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) {
|
switch (event->keyval) {
|
||||||
case GDK_KEY_Escape:
|
case GDK_KEY_Escape:
|
||||||
exit_command_mode(info->panel.vte, &info->select);
|
exit_command_mode(info->panel.vte, &info->select);
|
||||||
|
|
Loading…
Reference in New Issue