From: Daniel Carl Date: Wed, 12 Mar 2014 22:46:31 +0000 (+0100) Subject: Added missed default shortcuts. X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=603450ab5bd9fe638aa8758e48ef280ba02477ef;p=vimb.git Added missed default shortcuts. Move the shortcut initializing and cleanup into setting.c, because the shortcuts are more like settings instead of a own entity. --- diff --git a/src/main.c b/src/main.c index 2d39ba5..c6ae00b 100644 --- a/src/main.c +++ b/src/main.c @@ -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 */ diff --git a/src/setting.c b/src/setting.c index 4989e52..b732e92 100644 --- a/src/setting.c +++ b/src/setting.c @@ -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)