From: Daniel Carl Date: Wed, 14 Jan 2015 12:48:05 +0000 (+0100) Subject: Don't write autocmd to command history. X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=933a551bcf8cf1a15a35741cf41d23b863c21c48;p=vimb.git Don't write autocmd to command history. --- diff --git a/src/autocmd.c b/src/autocmd.c index 5b32f0b..e856a4c 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -277,7 +277,8 @@ gboolean autocmd_run(AuEvent event, const char *uri, const char *group) } /* run the command */ /* TODO shoult the result be tested for RESULT_COMPLETE? */ - ex_run_string(cmd->excmd); + /* run command and make sure it's not writte to command history */ + ex_run_string(cmd->excmd, false); } } diff --git a/src/ex.c b/src/ex.c index e23929b..89d31a3 100644 --- a/src/ex.c +++ b/src/ex.c @@ -462,7 +462,7 @@ static void input_activate(void) case ':': mode_enter('n'); - res = ex_run_string(cmd); + res = ex_run_string(cmd, true); if (!(res & VB_CMD_KEEPINPUT)) { /* clear input on success if this is not explicit ommited */ vb_set_input_text(""); @@ -473,7 +473,7 @@ static void input_activate(void) g_free(text); } -VbCmdResult ex_run_string(const char *input) +VbCmdResult ex_run_string(const char *input, gboolean enable_history) { /* copy to have original command for history */ const char *in = input; @@ -489,7 +489,7 @@ VbCmdResult ex_run_string(const char *input) } } - if (!nohist) { + if (enable_history && !nohist) { history_add(HISTORY_COMMAND, input, NULL); vb_register_add(':', input); } diff --git a/src/ex.h b/src/ex.h index 95cf194..9b706e3 100644 --- a/src/ex.h +++ b/src/ex.h @@ -28,6 +28,6 @@ void ex_leave(void); VbResult ex_keypress(int key); void ex_input_changed(const char *text); gboolean ex_fill_completion(GtkListStore *store, const char *input); -VbCmdResult ex_run_string(const char *input); +VbCmdResult ex_run_string(const char *input, gboolean enable_history); #endif /* end of include guard: _EX_H */ diff --git a/src/main.c b/src/main.c index d76b0a9..9e2e1ed 100644 --- a/src/main.c +++ b/src/main.c @@ -939,7 +939,7 @@ static void read_config(void) if (*line == '#') { continue; } - if (ex_run_string(line) & VB_CMD_ERROR ) { + if (ex_run_string(line, false) & VB_CMD_ERROR ) { g_warning("Invalid user config: '%s'", line); } } @@ -1626,7 +1626,7 @@ int main(int argc, char *argv[]) /* process the --cmd if this was given */ for (GSList *l = vb.config.cmdargs; l; l = l->next) { - ex_run_string(l->data); + ex_run_string(l->data, false); } /* active the registers and writing of command history */