[gnome-builder/wip/libide] libide: add emacs keybindings css



commit 05e44c7d5a623f5ffcd0776d20eb73f45c59b8fe
Author: Christian Hergert <christian hergert me>
Date:   Tue Mar 3 16:15:44 2015 -0800

    libide: add emacs keybindings css
    
    This does not hook it up, but gets the pieces in place to be wired
    together by application settings.
    
    Keybindings are provided by Alex via his emacs work.
    
    
https://git.gnome.org/browse/gnome-builder/commit/src/resources/css?h=wip/alexl/emacs-css-keys&id=d21fa4ec2e9ac9149f40b3c0dc4d3b4cf73e8032

 data/keybindings/emacs.css            |  107 +++++++++++++++++++++++++++++++++
 libide/resources/libide.gresource.xml |    2 +
 2 files changed, 109 insertions(+), 0 deletions(-)
---
diff --git a/data/keybindings/emacs.css b/data/keybindings/emacs.css
new file mode 100644
index 0000000..1fcb046
--- /dev/null
+++ b/data/keybindings/emacs.css
@@ -0,0 +1,107 @@
+ binding-set builder-emacs-text-entry
+{
+  bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) };
+  bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) };
+  bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) };
+  bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) };
+
+  bind "<alt>b" { "move-cursor" (words, -1, 0) };
+  bind "<shift><alt>b" { "move-cursor" (words, -1, 1) };
+  bind "<alt>f" { "move-cursor" (words, 1, 0) };
+  bind "<shift><alt>f" { "move-cursor" (words, 1, 1) };
+
+  bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) };
+  bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) };
+  bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) };
+  bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) };
+
+  bind "<ctrl>w" { "cut-clipboard" () };
+  bind "<alt>w" { "copy-clipboard" () };
+  bind "<ctrl>y" { "paste-clipboard" () };
+
+  bind "<ctrl>d" { "delete-from-cursor" (chars, 1) };
+  bind "<alt>d" { "delete-from-cursor" (word-ends, 1) };
+  bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) };
+  bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) };
+
+  bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
+                      "insert-at-cursor" (" ") };
+  bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
+                         "insert-at-cursor" (" ")  };
+}
+
+/*
+ * Bindings for GtkTextView
+ */
+ binding-set builder-emacs-text-view
+{
+  bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) };
+  bind "<shift><ctrl>p" { "move-cursor" (display-lines, -1, 1) };
+  bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) };
+  bind "<shift><ctrl>n" { "move-cursor" (display-lines, 1, 1) };
+
+  bind "<ctrl>space" { "set-anchor" () };
+  bind "<ctrl>KP_Space" { "set-anchor" () };
+}
+
+ binding-set builder-emacs-source-view
+{
+  bind "<ctrl>x" { "set-mode" ("emacs-x", transient) };
+  bind "<ctrl>underscore" { "undo" () };
+  bind "<alt>x" { "action" ("win", "show-command-bar", "") };
+  bind "<ctrl>s" { "action" ("editor-frame", "find", "") };
+  bind "<ctrl>period" { "action" ("win", "global-search", "") };
+  bind "<ctrl>comma" { "action" ("app", "preferences", "") };
+  bind "<alt>n" { "action" ("editor-frame", "next-diagnostic", "") };
+  bind "<alt>p" { "action" ("editor-frame", "previous-diagnostic", "") };
+  bind "<ctrl>j" { "action" ("editor-view", "switch-pane", "") };
+  bind "<shift><ctrl>j" { "action" ("editor-view", "toggle-split", "") };
+  bind "<ctrl><alt>Page_Up" { "action" ("stack", "previous-document", "") };
+  bind "<ctrl><alt>Page_Down" { "action" ("stack", "next-document", "") };
+}
+
+ binding-set builder-emacs-source-view-x
+{
+  bind "<ctrl>c" { "action" ("app", "quit", "") };
+  bind "0" { "action" ("stack", "close", "") };
+  bind "k" { "action" ("stack", "close", "") };
+  bind "<ctrl>f" { "action" ("workspace", "open", "") };
+  bind "<ctrl>s" { "action" ("stack", "save", "") };
+  bind "s" { "action" ("win", "save-all", "") };
+  bind "b" { "action" ("workspace", "new-document", "") };
+  bind "<ctrl>w" { "action" ("stack", "save-as", "") };
+  bind "u" { "redo" () };
+  bind "2" { "action" ("editor-view", "toggle-split", "") };
+  bind "3" { "action" ("stack", "split-document-right", "") };
+  bind "o" { "action" ("stack", "focus-right", "") };
+}
+
+/*
+ * Bindings for GtkTreeView
+ */
+ binding-set builder-emacs-tree-view
+{
+  bind "<ctrl>s" { "start-interactive-search" () };
+  bind "<ctrl>f" { "move-cursor" (logical-positions, 1) };
+  bind "<ctrl>b" { "move-cursor" (logical-positions, -1) };
+}
+
+GtkEntry {
+  gtk-key-bindings: builder-emacs-text-entry;
+}
+
+GtkTextView {
+  gtk-key-bindings: builder-emacs-text-entry, builder-emacs-text-view;
+}
+
+GtkSourceView {
+  gtk-key-bindings: builder-emacs-text-entry, builder-emacs-source-view, builder-emacs-text-view;
+}
+
+IdeSourceViewMode.emacs-x {
+  gtk-key-bindings: builder-emacs-source-view-x;
+}
+
+GtkTreeView {
+  gtk-key-bindings: builder-emacs-tree-view;
+}
diff --git a/libide/resources/libide.gresource.xml b/libide/resources/libide.gresource.xml
index 0cd0f1f..9b05339 100644
--- a/libide/resources/libide.gresource.xml
+++ b/libide/resources/libide.gresource.xml
@@ -12,5 +12,7 @@
     <file alias="snippets/shebang.snippets">../../data/snippets/shebang.snippets</file>
     <file alias="snippets/vala.snippets">../../data/snippets/vala.snippets</file>
     <file alias="snippets/xml.snippets">../../data/snippets/xml.snippets</file>
+
+    <file alias="keybindings/emacs.css">../../data/keybindings/emacs.css</file>
   </gresource>
 </gresources>


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