Skip to content

Instantly share code, notes, and snippets.

@thinca
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinca/5cfc8390d691b8fc5639 to your computer and use it in GitHub Desktop.
Save thinca/5cfc8390d691b8fc5639 to your computer and use it in GitHub Desktop.
diff -r 79c59b4c9d20 runtime/doc/quickfix.txt
--- a/runtime/doc/quickfix.txt Sat Oct 11 14:47:26 2014 +0200
+++ b/runtime/doc/quickfix.txt Sun Oct 12 14:07:01 2014 +0900
@@ -141,8 +141,9 @@
current window is used instead of the quickfix list.
*:cq* *:cquit*
-:cq[uit][!] Quit Vim with an error code, so that the compiler
+:cq[uit][!] [code] Quit Vim with an error code, so that the compiler
will not compile the same file again.
+ If [code] is provided, vim returns that code at exit.
WARNING: All changes in files are lost! Also when the
[!] is not used. It works like ":qall!" |:qall|,
except that Vim returns a non-zero exit code.
diff -r 79c59b4c9d20 src/ex_cmds.h
--- a/src/ex_cmds.h Sat Oct 11 14:47:26 2014 +0200
+++ b/src/ex_cmds.h Sun Oct 12 14:07:01 2014 +0900
@@ -274,7 +274,7 @@
EX(CMD_cpfile, "cpfile", ex_cnext,
RANGE|NOTADR|COUNT|TRLBAR|BANG),
EX(CMD_cquit, "cquit", ex_cquit,
- TRLBAR|BANG),
+ RANGE|NOTADR|COUNT|TRLBAR|BANG|ZEROR),
EX(CMD_crewind, "crewind", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG),
EX(CMD_cscope, "cscope", do_cscope,
diff -r 79c59b4c9d20 src/ex_docmd.c
--- a/src/ex_docmd.c Sat Oct 11 14:47:26 2014 +0200
+++ b/src/ex_docmd.c Sun Oct 12 14:07:01 2014 +0900
@@ -6637,10 +6637,16 @@
*/
static void
ex_cquit(eap)
- exarg_T *eap UNUSED;
-{
- getout(1); /* this does not always pass on the exit code to the Manx
- compiler. why? */
+ exarg_T *eap;
+{
+ if (*eap->arg)
+ eap->errmsg = e_invarg;
+ else
+ /*
+ * this does not always pass on the exit code to the Manx compiler.
+ * why?
+ */
+ getout((int)eap->line2);
}
/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment