[gnome-builder/wip/vim] vim: implement <Control>F



commit a42c5d9663eee6889ea43cf6d48a427ceaf3b9d5
Author: Christian Hergert <christian hergert me>
Date:   Wed Oct 1 15:26:50 2014 -0700

    vim: implement <Control>F

 src/editor/gb-editor-vim.c            |   26 +++++++++++++++++++++++++-
 src/resources/keybindings/default.ini |    5 ++++-
 2 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 12a30a8..b11dd01 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1343,6 +1343,18 @@ gb_editor_vim_page_up (GbEditorVim *vim)
                          FALSE);
 }
 
+static void
+gb_editor_vim_page_down (GbEditorVim *vim)
+{
+  g_assert (GB_IS_EDITOR_VIM (vim));
+
+  g_signal_emit_by_name (vim->priv->text_view,
+                         "move-cursor",
+                         GTK_MOVEMENT_PAGES,
+                         1,
+                         FALSE);
+}
+
 static gboolean
 gb_editor_vim_get_has_selection (GbEditorVim *vim)
 {
@@ -1479,7 +1491,7 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
 
     case GDK_KEY_b:
       /*
-       * Move backward by one word.
+       * Move backward by one word, or by a page if <Control> is set.
        */
       if ((event->state & GDK_CONTROL_MASK) != 0)
         gb_editor_vim_page_up (vim);
@@ -1487,6 +1499,18 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
         gb_editor_vim_move_backward_word (vim);
       return TRUE;
 
+    case GDK_KEY_f:
+      /*
+       * Move forward by one page if <Control> is set.
+       */
+      if ((event->state & GDK_CONTROL_MASK) != 0)
+        {
+          gb_editor_vim_page_down (vim);
+          return TRUE;
+        }
+
+      break;
+
     case GDK_KEY_x:
       /*
        * Delete the current selection.
diff --git a/src/resources/keybindings/default.ini b/src/resources/keybindings/default.ini
index da04d05..d2427d0 100644
--- a/src/resources/keybindings/default.ini
+++ b/src/resources/keybindings/default.ini
@@ -9,7 +9,10 @@ go-backward = <Control>O
 
 [workbench]
 close-tab = <Control>W
-find = <Control>F
+# Temporary, so we can test vim.
+# Longer term, I want a custom vim.ini for when using vim for which
+# this will be ignored.
+find = <Control><Shift>F
 new-tab = <Control><Shift>T
 
 [editor]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]