[gnome-builder/wip/slaf/vim-textobjects: 8/8] vim: add va( va) vab va{ va} vaB va[ va] va< va>



commit 0ead361b1c0c52eb286609b8183e431e0fe4c34e
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Fri Oct 23 16:19:45 2015 +0200

    vim: add va( va) vab va{ va} vaB va[ va] va< va>
    
                Work like in vim and with count too

 data/keybindings/vim.css |   57 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index df0cf90..c55d911 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -1520,6 +1520,7 @@
 @binding-set builder-vim-source-view-visual
 {
   bind "i" { "set-mode" ("vim-visual-i", transient) };
+  bind "a" { "set-mode" ("vim-visual-a", transient) };
 
   bind "colon" { "action" ("win", "show-command-bar", "") };
 
@@ -1741,6 +1742,53 @@
                      "set-mode" ("vim-visual", permanent) };
 }
 
+ binding-set builder-vim-source-view-visual-a
+{
+  /* va( , va) , vab */
+  bind "parenleft" { "begin-macro" ()
+                     "select-inner" ("(", ")", 0)
+                     "set-mode" ("vim-normal", permanent) };
+
+  bind "parenright" { "begin-macro" ()
+                      "select-inner" ("(", ")", 0)
+                      "set-mode" ("vim-normal", permanent) };
+
+  bind "b" { "begin-macro" ()
+             "select-inner" ("(", ")", 0)
+             "set-mode" ("vim-normal", permanent) };
+
+  /* va[ and va] */
+  bind "bracketleft" { "begin-macro" ()
+                       "select-inner" ("[", "]", 0)
+                       "set-mode" ("vim-visual", permanent) };
+
+  bind "bracketright" { "begin-macro" ()
+                        "select-inner" ("[", "]", 0)
+                        "set-mode" ("vim-visual", permanent) };
+
+  /* va{ , va} , vaB */
+  bind "braceleft" { "begin-macro" ()
+                     "select-inner" ("{", "}", 0)
+                     "set-mode" ("vim-visual", permanent) };
+
+  bind "braceright" { "begin-macro" ()
+                      "select-inner" ("{", "}", 0)
+                      "set-mode" ("vim-visual", permanent) };
+
+  bind "<shift>b" { "begin-macro" ()
+                    "select-inner" ("{", "}", 0)
+                    "set-mode" ("vim-visual", permanent) };
+
+  /* va< and va> */
+    bind "less" { "begin-macro" ()
+                  "select-inner" ("<", ">", 0)
+                  "set-mode" ("vim-visual", permanent) };
+
+    bind "greater" { "begin-macro" ()
+                     "select-inner" ("<", ">", 0)
+                     "set-mode" ("vim-visual", permanent) };
+}
+
 @binding-set builder-vim-source-view-visual-line-with-count
 {
   bind "0" { "append-to-count" (0)
@@ -2112,6 +2160,15 @@ IdeSourceViewMode.vim-visual-i {
                     builder-vim-source-view-visual-i;
 }
 
+IdeSourceViewMode.vim-visual-a {
+  -IdeSourceViewMode-suppress-unbound: true;
+  -IdeSourceViewMode-block-cursor: true;
+  -IdeSourceViewMode-display-name: "Visual";
+
+  gtk-key-bindings: builder-vim-source-view,
+                    builder-vim-source-view-visual-a;
+}
+
 IdeSourceViewMode.vim-visual-with-count {
   -IdeSourceViewMode-suppress-unbound: true;
   -IdeSourceViewMode-block-cursor: true;


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