[gnome-builder] vim: implement gg in visual line mode



commit 2469c3400c42504cbace76faedc59c2ba1816c0c
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 18 11:46:00 2017 -0800

    vim: implement gg in visual line mode
    
    This is a bit of a hack, but it is sufficient until we have a real
    shortcut context as part of the keybindings improvements.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777453

 data/keybindings/vim.css |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index 3698653..c1cbfd3 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -1870,10 +1870,27 @@
 
 @binding-set builder-vim-source-view-visual-line-g
 {
-  bind "g" { "movement" (first-line, 1, 1, 0)
+  /* XXX: This is a bit of a hack to just reuse the special
+   *      line handling case to wrap around our first selected
+   *      line. Otherwise, we lose that line. This type of stuff
+   *      really belongs in a special case keybinding context
+   *      once that subsystem lands.
+   */
+  bind "g" { "clear-count" ()
+             "append-to-count" (1)
+             "append-to-count" (0)
+             "append-to-count" (0)
+             "append-to-count" (0)
+             "append-to-count" (0)
+             "append-to-count" (0)
+             "append-to-count" (0)
+             "append-to-count" (0)
+             "movement" (previous-line, 1, 0, 1)
              "set-mode" ("vim-visual-line", permanent) };
   bind "j" { "movement" (next-line, 1, 1, 0)
              "set-mode" ("vim-visual-line", permanent) };
+  bind "k" { "movement" (next-line, 1, 1, 0)
+             "set-mode" ("vim-visual-line", permanent) };
 }
 
 @binding-set builder-vim-source-view-insert
@@ -2312,6 +2329,8 @@ bind "KP_Multiply" { "save-insert-mark" ()
   bind "k" { "movement" (previous-line, 1, 0, 1) };
   bind "j" { "movement" (next-line, 1, 0, 1) };
 
+  bind "g" { "set-mode" ("vim-visual-line-g", transient ) };
+
   /* just to be nice */
   bind "h" { "end-macro" ()
              "clear-selection" ()


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