[gnome-builder/wip/slaf/vim-textobjects: 6/8] vim: add da( da) dab da{ da} daB da[ da] da< da>



commit 5eba400d374585938fe261bbdb41d033016d351a
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Fri Oct 23 14:48:10 2015 +0200

    vim: add da( da) dab da{ da} daB da[ da] da< da>
    
            Work like in vim and with count too

 data/keybindings/vim.css |   89 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index d34c6d8..1c09921 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -920,6 +920,7 @@
                  "end-macro" () };
 
   bind "i" { "set-mode" ("vim-normal-d-i", transient) };
+  bind "a" { "set-mode" ("vim-normal-d-a", transient) };
   bind "g" { "set-mode" ("vim-normal-d-g", transient) };
 
   bind "f" { "begin-macro" ()
@@ -1335,6 +1336,86 @@
                      "delete-selection" () };
 }
 
+ binding-set builder-vim-source-view-normal-d-a
+{
+  /* da( , da) , dab */
+  bind "parenleft" { "begin-macro" ()
+                     "select-inner" ("(", ")", 0)
+                     "set-mode" ("vim-normal", permanent)
+                     "copy-clipboard" ()
+                     "selection-theatric" (shrink)
+                     "delete-selection" ()
+                     "clear-count" () };
+
+  bind "parenright" { "begin-macro" ()
+                      "select-inner" ("(", ")", 0)
+                      "set-mode" ("vim-normal", permanent)
+                      "copy-clipboard" ()
+                      "selection-theatric" (shrink)
+                      "delete-selection" ()
+                      "clear-count" () };
+
+  bind "b" { "begin-macro" ()
+             "select-inner" ("(", ")", 0)
+             "set-mode" ("vim-normal", permanent)
+             "copy-clipboard" ()
+             "selection-theatric" (shrink)
+             "delete-selection" ()
+             "clear-count" () };
+
+  /* da[ and da] */
+  bind "bracketleft" { "begin-macro" ()
+                       "select-inner" ("[", "]", 0)
+                       "set-mode" ("vim-normal", permanent)
+                       "copy-clipboard" ()
+                       "selection-theatric" (shrink)
+                       "delete-selection" () };
+
+  bind "bracketright" { "begin-macro" ()
+                        "select-inner" ("[", "]", 0)
+                        "set-mode" ("vim-normal", permanent)
+                        "copy-clipboard" ()
+                        "selection-theatric" (shrink)
+                        "delete-selection" () };
+
+  /* da{ , da} , daB */
+  bind "braceleft" { "begin-macro" ()
+                     "select-inner" ("{", "}", 0)
+                     "set-mode" ("vim-normal", permanent)
+                     "copy-clipboard" ()
+                     "selection-theatric" (shrink)
+                     "delete-selection" () };
+
+  bind "braceright" { "begin-macro" ()
+                      "select-inner" ("{", "}", 0)
+                      "set-mode" ("vim-normal", permanent)
+                      "copy-clipboard" ()
+                      "selection-theatric" (shrink)
+                      "delete-selection" () };
+
+  bind "<shift>b" { "begin-macro" ()
+                    "select-inner" ("{", "}", 0)
+                    "set-mode" ("vim-normal", permanent)
+                    "copy-clipboard" ()
+                    "selection-theatric" (shrink)
+                    "delete-selection" () };
+
+  /* da< and da> */
+    bind "less" { "begin-macro" ()
+                  "select-inner" ("<", ">", 0)
+                  "set-mode" ("vim-normal", permanent)
+                  "copy-clipboard" ()
+                  "selection-theatric" (shrink)
+                  "delete-selection" () };
+
+    bind "greater" { "begin-macro" ()
+                     "select-inner" ("<", ">", 0)
+                     "set-mode" ("vim-normal", permanent)
+                     "copy-clipboard" ()
+                     "selection-theatric" (shrink)
+                     "delete-selection" () };
+}
+
 @binding-set builder-vim-source-view-visual-g
 {
   bind "e" { "movement" (previous-word-end, 1, 1, 0)
@@ -1872,6 +1953,14 @@ IdeSourceViewMode.vim-normal-d-i {
                     builder-vim-source-view-normal-d-i;
 }
 
+IdeSourceViewMode.vim-normal-d-a {
+  -IdeSourceViewMode-suppress-unbound: true;
+  -IdeSourceViewMode-block-cursor: true;
+
+  gtk-key-bindings: builder-vim-source-view,
+                    builder-vim-source-view-normal-d-a;
+}
+
 IdeSourceViewMode.vim-normal-g {
   -IdeSourceViewMode-suppress-unbound: true;
   -IdeSourceViewMode-block-cursor: true;


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