Added bang for :eval.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 22 Sep 2014 13:03:49 +0000 (15:03 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 22 Sep 2014 13:03:49 +0000 (15:03 +0200)
Allow to make :eval silent by using the bang on the ex command.

doc/vimb.1
src/ex.c

index c190b27..f402709 100644 (file)
@@ -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.
index c42b348..c180462 100644 (file)
--- 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);