From ed5c84bbade44f3698b03c55223363ea1009a0fe Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Mon, 22 Sep 2014 15:03:49 +0200 Subject: [PATCH] Added bang for :eval. Allow to make :eval silent by using the bang on the ex command. --- doc/vimb.1 | 11 ++++++++--- src/ex.c | 12 +++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/vimb.1 b/doc/vimb.1 index c190b27..f402709 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -626,10 +626,12 @@ part of the command. Example: :eval document.cookie .TP -.BI ":no[rmal][!] [" CMDS ] +.BI :e[val]! " JAVASCRIPT" +Like :e[val], but there is nothing print to the input box. +.TP +.BI ":no[rmal] [" CMDS ] Execute normal mode commands \fICMDS\fP. This makes it possible to execute -normal mode commands typed on the input box. If the \fI!\fP is given, mappings -will not be used. +normal mode commands typed on the input box. \fICMDS\fP cannot start with a space. Put a count of 1 (one) before it, "1 " is one space. @@ -639,6 +641,9 @@ part of the command. Example: :set scripts!|no! R .TP +.BI ":no[rmal]! [" CMDS ] +Like :no[rmal] but no mapping is applied to \fICMDS\fP. +.TP .B :ha[rdcopy] Print current document. Open a GUI dialog where you can select the printer, number of copies, orientation, etc. diff --git a/src/ex.c b/src/ex.c index c42b348..c180462 100644 --- a/src/ex.c +++ b/src/ex.c @@ -159,7 +159,7 @@ static ExInfo commands[] = { {"hardcopy", EX_HARDCOPY, ex_hardcopy, EX_FLAG_NONE}, {"handler-add", EX_HANDADD, ex_handlers, EX_FLAG_RHS}, {"handler-remove", EX_HANDREM, ex_handlers, EX_FLAG_RHS}, - {"eval", EX_EVAL, ex_eval, EX_FLAG_CMD}, + {"eval", EX_EVAL, ex_eval, EX_FLAG_CMD|EX_FLAG_BANG}, {"imap", EX_IMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, {"inoremap", EX_INOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, {"iunmap", EX_IUNMAP, ex_unmap, EX_FLAG_LHS}, @@ -736,10 +736,12 @@ static gboolean ex_eval(const ExArg *arg) webkit_web_frame_get_global_context(webkit_web_view_get_main_frame(vb.gui.webview)), arg->rhs->str, NULL, &value ); - if (success) { - vb_echo(VB_MSG_NORMAL, false, "%s", value); - } else { - vb_echo(VB_MSG_ERROR, true, "%s", value); + if (!arg->bang) { + if (success) { + vb_echo(VB_MSG_NORMAL, false, "%s", value); + } else { + vb_echo(VB_MSG_ERROR, true, "%s", value); + } } g_free(value); -- 2.20.1