runtime(sh): consider sh as POSIX shell by default

Also, do not set g:is_kornshell when g:is_posix is set. BSD shells are
POSIX but many are derived from the ash shell.

closes: #16939

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Mohamed Akram
2025-03-21 17:52:08 +01:00
committed by Christian Brabandt
parent 5753084042
commit 51a06ecee0
2 changed files with 49 additions and 49 deletions

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 9.1. Last change: 2025 Mar 15
*syntax.txt* For Vim version 9.1. Last change: 2025 Mar 21
VIM REFERENCE MANUAL by Bram Moolenaar
@ -3512,25 +3512,25 @@ cases pertain, then the first line of the file is examined (ex. looking for
/bin/sh /bin/ksh /bin/bash). If the first line specifies a shelltype, then
that shelltype is used. However some files (ex. .profile) are known to be
shell files but the type is not apparent. Furthermore, on many systems sh is
symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh" (Posix).
symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh" (POSIX).
One may specify a global default by instantiating one of the following
variables in your <.vimrc>:
ksh: >
let g:is_kornshell = 1
< posix: (using this is nearly the same as setting g:is_kornshell to 1) >
< posix: (default) >
let g:is_posix = 1
< bash: >
let g:is_bash = 1
< sh: (default) Bourne shell >
< dash: >
let g:is_dash = 1
< sh: Bourne shell >
let g:is_sh = 1
< (dash users should use posix)
If there's no "#! ..." line, and the user hasn't availed himself/herself of a
default sh.vim syntax setting as just shown, then syntax/sh.vim will assume
the Bourne shell syntax. No need to quote RFCs or market penetration
the POSIX shell syntax. No need to quote RFCs or market penetration
statistics in error reports, please -- just select the default version of the
sh your system uses and install the associated "let..." in your <.vimrc>.