Added missed default shortcuts.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 12 Mar 2014 22:46:31 +0000 (23:46 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 12 Mar 2014 22:46:31 +0000 (23:46 +0100)
Move the shortcut initializing and cleanup into setting.c, because the
shortcuts are more like settings instead of a own entity.

src/main.c
src/setting.c

index 2d39ba5..c6ae00b 100644 (file)
@@ -360,7 +360,6 @@ void vb_quit(void)
     map_cleanup();
     mode_cleanup();
     setting_cleanup();
-    shortcut_cleanup();
     history_cleanup();
 
     for (int i = 0; i < FILES_LAST; i++) {
@@ -665,7 +664,6 @@ static void init_core(void)
     init_files();
     session_init();
     setting_init();
-    shortcut_init();
     read_config();
 
     /* initially apply input style */
index 4989e52..b732e92 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "config.h"
 #include "setting.h"
+#include "shortcut.h"
 #include "util.h"
 #include "completion.h"
 #include "js.h"
@@ -136,8 +137,15 @@ void setting_init(void)
         s = &default_settings[i];
         /* use alias as key if available */
         g_hash_table_insert(settings, (gpointer)s->alias != NULL ? s->alias : s->name, s);
+        /* set the default settings */
         s->func(s, false);
     }
+
+    /* initialize the shortcuts and set the default shortcuts */
+    shortcut_init();
+    shortcut_add("dl", "https://duckduckgo.com/html/?q=$0");
+    shortcut_add("dd", "https://duckduckgo.com/?q=$0");
+    shortcut_set_default("dl");
 }
 
 void setting_cleanup(void)
@@ -145,6 +153,7 @@ void setting_cleanup(void)
     if (settings) {
         g_hash_table_destroy(settings);
     }
+    shortcut_cleanup();
 }
 
 gboolean setting_run(char *name, const char *param)