Janis Papanagnou wrote:
On 8/7/23 4:34 PM, Janis Papanagnou wrote:
Is there some Vim syntax file existing that handles a contemporary
Kornshell syntax (ksh93u+) correctly, i.e. without displaying valid
ksh93 constructs as errors (as the existing sh.vim does[*])?
Have you tried the zsh syntax highlighting (:set filetype=zsh)? I tried
these two constructs and neither was marked as an error.
Zsh supports a fairly large subset of ksh syntax and semantics,[1][2] so I'd imagine that a lot of your scripts would be highlighted in a reasonable way by the zsh syntax file. (If anything, you might run into problems where ksh syntax errors *aren't* flagged because they're valid in zsh.)
Hope this helps,
Benjamin
[1] At least that's my impression as a zsh user but ksh non-user.
[2] I don't know whether the ksh emulation ever covered 100% of ksh syntax
and semantics, and even if it did in the past, ksh may have evolved
since then. I am far from an expert here :-)
On 18.08.2023 02:01, Benjamin Esham wrote:
Janis Papanagnou wrote:The only thing is that my (k)sh syntax file supports embedded awk
scripts so that both, ksh and awk, are highlighted accordingly.
The zsh syntax does not support that feature, the whole awk program
is marked monochrome as an undifferentiated string. It may be that
this embedded syntax feature had been added later (it was probably contributed by someone in the shell and/or awk newsgroup). (I'll
have a look into that, but I'm no expert in vim's syntax language,
so I have to see what I can make of it.)
[ awk syntax within ksh syntax highlighting ]
Check `:h sh-awk`:
[...]
file into $HOME/.vim/after/syntax/sh/awkembed.vim: >
[code]
This code will then let the awk code in the single quotes: >
awk '...awk code here...'
be highlighted using the awk highlighting syntax. Clearly this may be
extended to other languages.
[...]
On 20.09.2023 14:50, castAway wrote:
[ awk syntax within ksh syntax highlighting ]
Check `:h sh-awk`:
[...]
file into $HOME/.vim/after/syntax/sh/awkembed.vim: >
[code]
This code will then let the awk code in the single quotes: >
awk '...awk code here...'
be highlighted using the awk highlighting syntax. Clearly this may be
extended to other languages.
[...]
Thanks! :-)
On 20.09.2023 20:47, Janis Papanagnou wrote:
On 20.09.2023 14:50, castAway wrote:
[ awk syntax within ksh syntax highlighting ]
I tried to install a $HOME/.vim/after/syntax/zsh/awkembed.vi for zsh
but obviously this is not how this is supposed to work.
Any idea or how to fix both issues reliably (not just one or the other)?
Janis
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 498 |
Nodes: | 16 (3 / 13) |
Uptime: | 13:03:11 |
Calls: | 9,823 |
Calls today: | 2 |
Files: | 13,759 |
Messages: | 6,190,954 |