Janis Papanagnou wrote:
Hi Christian,

thanks for the explanation/history. - Some remarks below...

On Do, 28 Mai 2026, Janis Papanagnou wrote:

I just cloned  https://github.com/vim/vim.git

I copied the various existing files  bash.vim, sh.vim, zsh.vim
(which I'm interested in) below my local  $HOME/.vim
into their respective directories  syntax, indent, and ftplugin .

Opening a local test file that contains (besides other things)

if [[ "$1" = "$2" ]]
...
x=$'\v'
Traditionally, the vim sh filetype supports only the very narrow
traditional (Bourne) syntax, not Bash, not ksh and not even POSIX
syntax.

However there were a few complaints over time, so a few heuristics have
been built into the sh syntax script, which tries to guess what sh
dialect is in use, e.g. by setting global variables or by inspecting the
shebang line.

I believe the above is not valid Bourne shell syntax, that's why you see
those errors.
Yes, that is correct. (Actually Bourne shell 'sh' is meaningless nowadays.
The minimum expected standard is the POSIX Shell 'sh', based on ksh88.)

The sh.vim syntax file was written to cover three types: ksh, bash, sh, and was extended to handle dash. There are various ways that sh.vim attempts to infer which shell the user actually wanted. However, this process is likely to fail to be a good mind reader, and so things like:

let g:is_kornshell= 1
let g:is_bash= 1
let g:is_posix= 1

placed in your .vimrc will get sh.vim to do what you want. The reason why it defaults to Bourne shell (sh) is to encourage users to specify what they actually tend to use. In my experience, nearly half of the users use bash and near half use kornshell/posix. There are plenty of people that feel that their choice should be made the default; since bash/posix/ksh share a lot of non-Bourne features about half will be satisfied and the other half will be constantly issuing bug reports.

Chip Campbell

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/3d7aa4be-ee65-faf0-bd05-51daff280d37%40gmail.com.

Raspunde prin e-mail lui