[gnome-builder] vim: add ca( ca) cab ca{ ca} caB ca[ ca] ca< ca>



commit 1edb34239fe896249c384ad936975e5d45583f5d
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Fri Oct 23 13:04:46 2015 +0200

    vim: add ca( ca) cab ca{ ca} caB ca[ ca] ca< ca>
    
    Work like in vim, with count too

 data/keybindings/vim.css |   90 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index 2128e6d..58bf3bc 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -552,6 +552,8 @@
 {
   bind "i" { "set-mode" ("vim-normal-c-i", transient) };
 
+  bind "a" { "set-mode" ("vim-normal-c-a", transient) };
+
   bind "e" { "begin-macro" ()
              "set-mode" ("vim-insert", permanent)
              "movement" (next-word-end, 1, 0, 1)
@@ -783,6 +785,86 @@
                      "delete-selection" () };
 }
 
+ binding-set builder-vim-source-view-normal-c-a
+{
+  /* ca( , ca) , cab */
+  bind "parenleft" { "begin-macro" ()
+                     "select-inner" ("(", ")", 0)
+                     "set-mode" ("vim-insert", permanent)
+                     "copy-clipboard" ()
+                     "selection-theatric" (shrink)
+                     "delete-selection" ()
+                     "clear-count" () };
+
+  bind "parenright" { "begin-macro" ()
+                      "select-inner" ("(", ")", 0)
+                      "set-mode" ("vim-insert", permanent)
+                      "copy-clipboard" ()
+                      "selection-theatric" (shrink)
+                      "delete-selection" ()
+                      "clear-count" () };
+
+  bind "b" { "begin-macro" ()
+             "select-inner" ("(", ")", 0)
+             "set-mode" ("vim-insert", permanent)
+             "copy-clipboard" ()
+             "selection-theatric" (shrink)
+             "delete-selection" ()
+             "clear-count" () };
+
+  /* ca[ and ca] */
+  bind "bracketleft" { "begin-macro" ()
+                       "select-inner" ("[", "]", 0)
+                       "set-mode" ("vim-insert", permanent)
+                       "copy-clipboard" ()
+                       "selection-theatric" (shrink)
+                       "delete-selection" () };
+
+  bind "bracketright" { "begin-macro" ()
+                        "select-inner" ("[", "]", 0)
+                        "set-mode" ("vim-insert", permanent)
+                        "copy-clipboard" ()
+                        "selection-theatric" (shrink)
+                        "delete-selection" () };
+
+  /* ca{ , ca} , caB */
+  bind "braceleft" { "begin-macro" ()
+                     "select-inner" ("{", "}", 0)
+                     "set-mode" ("vim-insert", permanent)
+                     "copy-clipboard" ()
+                     "selection-theatric" (shrink)
+                     "delete-selection" () };
+
+  bind "braceright" { "begin-macro" ()
+                      "select-inner" ("{", "}", 0)
+                      "set-mode" ("vim-insert", permanent)
+                      "copy-clipboard" ()
+                      "selection-theatric" (shrink)
+                      "delete-selection" () };
+
+  bind "<shift>b" { "begin-macro" ()
+                    "select-inner" ("{", "}", 0)
+                    "set-mode" ("vim-insert", permanent)
+                    "copy-clipboard" ()
+                    "selection-theatric" (shrink)
+                    "delete-selection" () };
+
+  /* ca< and ca> */
+    bind "less" { "begin-macro" ()
+                  "select-inner" ("<", ">", 0)
+                  "set-mode" ("vim-insert", permanent)
+                  "copy-clipboard" ()
+                  "selection-theatric" (shrink)
+                  "delete-selection" () };
+
+    bind "greater" { "begin-macro" ()
+                     "select-inner" ("<", ">", 0)
+                     "set-mode" ("vim-insert", permanent)
+                     "copy-clipboard" ()
+                     "selection-theatric" (shrink)
+                     "delete-selection" () };
+}
+
 @binding-set builder-vim-source-view-normal-d
 {
   bind "Left"  { "begin-macro" ()
@@ -1680,6 +1762,14 @@ IdeSourceViewMode.vim-normal-c-i {
                     builder-vim-source-view-normal-c-i;
 }
 
+IdeSourceViewMode.vim-normal-c-a {
+  -IdeSourceViewMode-suppress-unbound: true;
+  -IdeSourceViewMode-block-cursor: true;
+
+  gtk-key-bindings: builder-vim-source-view,
+                    builder-vim-source-view-normal-c-a;
+}
+
 IdeSourceViewMode.vim-normal-d {
   -IdeSourceViewMode-suppress-unbound: true;
   -IdeSourceViewMode-block-cursor: true;


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