Vim exit status

589 views
Skip to first unread message

Ben Schmidt

unread,
Apr 6, 2012, 4:38:33 AM4/6/12
to vim use
Hi!

Does anyone know where Vim's behaviour regarding its exit status is documented? I
can't find it, but some strange things are happening, so I'm interested in finding
out why.

Ben.


Tim Chase

unread,
Apr 6, 2012, 6:15:49 AM4/6/12
to vim...@googlegroups.com, Ben Schmidt

The only documentation I know is at

:help :cq

though there are a few other notes if you do

:helpgrep exit\_[- ]*\(code\|status\)

-tim

Tony Mechelynck

unread,
Apr 6, 2012, 6:09:35 PM4/6/12
to vim...@googlegroups.com, Tim Chase, Ben Schmidt

The seven results from this helpgrep command are all unrelated to the
exit code returned to the shell when exiting Vim itself.

>
> -tim
>
>
>


Best regards,
Tony.
--
Misfortune, n.:
The kind of fortune that never misses.
-- Ambrose Bierce, "The Devil's Dictionary"

Tim Chase

unread,
Apr 6, 2012, 6:28:06 PM4/6/12
to Tony Mechelynck, vim...@googlegroups.com, Ben Schmidt
On 04/06/12 17:09, Tony Mechelynck wrote:
> On 06/04/12 12:15, Tim Chase wrote:
>> :help :cq
>>
>> though there are a few other notes if you do
>>
>> :helpgrep exit\_[- ]*\(code\|status\)
>
> The seven results from this helpgrep command are all unrelated to the
> exit code returned to the shell when exiting Vim itself.

In my slightly less-than-current Vim (7.2), I get 11 hits, of
which one lands on :cq and one lands on patch 6.1.376 (anomalous
exit codes for --version and --help). The rough answer I gather
is that "unless you quit with :cq or something dire happens, Vim
after 6.1.376 should quit with an exit status of 0".

-tim

Tony Mechelynck

unread,
Apr 7, 2012, 12:09:17 AM4/7/12
to Tim Chase, vim...@googlegroups.com, Ben Schmidt


Yeah, that's also what I gather.

For some reason copy-pasting gave me a spurious space at the end of the
helpgrep command. Without the space I get eleven occurrences, as follows:

1) if_tcl.txt:429:49 about error codes returned from Tcl to Vim
2) os_win32.txt:143:60 Win32s external commands don't return an exit code
3) quickfix.txt:148:39-60 :cq returns a nonzero exit code (unlike :qa!)
4) usr_24.txt:211:6-13 in an example typed text for i_CTRL-X_CTRL-F
5) usr_24.txt:219:6-13 ditto
6) version6.txt:8920:62 about patch 6.1.376 (zeroing the exit code)
7) version6.txt:8922:24 ditto
8) version7.txt:3347:40 patch 7.0.047: fixing configure exit code
9) version7.txt:3348:24 ditto
10) vi_diff.txt:994:22 about vi test 310 from POSIX
11) vi_diff.txt:1007:66 about ex test 509 from POSIX

#3 is for :cq, #6/#7 is only relevant for Vim versions 6.1.375 and
earlier, #10 and #11 might be relevant (but unexplained) with $VIM_POSIX
set, the rest are irrelevant to the problem at hand.

#2-#3-#6-#7 were the ones I hadn't caught at first.


Best regards,
Tony.
--
Manual, n.:
A unit of documentation. There are always three or more on a
given item. One is on the shelf; someone has the others. The
information you need in in the others.
-- Ray Simard

Reply all
Reply to author
Forward
0 new messages