[gnome-builder/wip/libide-merge] bindings: add helpers to create new document



commit eae964eab8e4a77e5955c26b38a1c15c45bf8057
Author: Christian Hergert <christian hergert me>
Date:   Mon Mar 23 03:32:04 2015 -0700

    bindings: add helpers to create new document

 data/keybindings/default.css |    1 +
 data/keybindings/emacs.css   |    4 ++--
 src/vim/gb-vim.c             |   19 ++++++++++++++++++-
 3 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/data/keybindings/default.css b/data/keybindings/default.css
index d7984eb..d7f7b70 100644
--- a/data/keybindings/default.css
+++ b/data/keybindings/default.css
@@ -4,6 +4,7 @@
   bind "<ctrl>comma" { "action" ("app", "preferences", "") };
   bind "<ctrl>f" { "action" ("frame", "find", "") };
   bind "<ctrl>period" { "action" ("workbench", "global-search", "") };
+  bind "<ctrl>n" { "action" ("workbench", "new-document", "") };
   bind "<ctrl>o" { "action" ("workbench", "open", "") };
   bind "<ctrl>s" { "action" ("view", "save", "") };
   bind "<ctrl><shift>s" { "action" ("view", "save-as", "") };
diff --git a/data/keybindings/emacs.css b/data/keybindings/emacs.css
index 1fc69dc..fc2b96b 100644
--- a/data/keybindings/emacs.css
+++ b/data/keybindings/emacs.css
@@ -93,10 +93,10 @@
   bind "<ctrl>c" { "action" ("app", "quit", "") };
   bind "0" { "action" ("stack", "close", "") };
   bind "k" { "action" ("stack", "close", "") };
-  bind "<ctrl>f" { "action" ("workspace", "open", "") };
+  bind "<ctrl>f" { "action" ("workbench", "open", "") };
   bind "<ctrl>s" { "action" ("view", "save", "") };
   bind "s" { "action" ("win", "save-all", "") };
-  bind "b" { "action" ("workspace", "new-document", "") };
+  bind "b" { "action" ("workbench", "new-document", "") };
   bind "<ctrl>w" { "action" ("view", "save-as", "") };
   bind "u" { "redo" () };
   bind "2" { "action" ("editor-view", "toggle-split", "") };
diff --git a/src/vim/gb-vim.c b/src/vim/gb-vim.c
index 07e0520..6d7fdce 100644
--- a/src/vim/gb-vim.c
+++ b/src/vim/gb-vim.c
@@ -434,6 +434,20 @@ gb_vim_command_edit (GtkSourceView  *source_view,
 }
 
 static gboolean
+gb_vim_command_tabe (GtkSourceView  *source_view,
+                     const gchar    *command,
+                     const gchar    *options,
+                     GError        **error)
+{
+  if (!gb_str_empty0 (options))
+    return gb_vim_command_edit (source_view, command, options, error);
+
+  gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "new-document", NULL);
+
+  return TRUE;
+}
+
+static gboolean
 gb_vim_command_quit (GtkSourceView  *source_view,
                      const gchar    *command,
                      const gchar    *options,
@@ -628,6 +642,7 @@ static const GbVimCommand vim_commands[] = {
   { "sort",        gb_vim_command_sort },
   { "split",       gb_vim_command_split },
   { "syntax",      gb_vim_command_syntax },
+  { "tabe",        gb_vim_command_tabe },
   { "vsplit",      gb_vim_command_vsplit },
   { "w",           gb_vim_command_write },
   { "wq",          gb_vim_command_wq },
@@ -973,7 +988,9 @@ gb_vim_complete (GtkSourceView *source_view,
     {
       if (g_str_has_prefix (line, "set "))
         gb_vim_complete_set (line, ar);
-      else if (g_str_has_prefix (line, "e ") || g_str_has_prefix (line, "edit "))
+      else if (g_str_has_prefix (line, "e ") ||
+               g_str_has_prefix (line, "edit ") ||
+               g_str_has_prefix (line, "tabe "))
         gb_vim_complete_edit (source_view, line, ar);
       else if (g_str_has_prefix (line, "colorscheme "))
         gb_vim_complete_colorscheme (line, ar);


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