🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #5

Re: Vim - set differing syntaxes in split view of the same source file?

#5
From: Janis Papanagnou
Date: Thu, 08 Oct 2026 15:13
63 lines
4645 bytes
On 2026-10-08 15:26, Kenny McCormack wrote:
[...]
> BTW, I may be mis-understanding the overall goal here.

Those embedded data are typically located "in one place", or more
importantly, in a sequential linear area. Given that I'd have that
split-window opened [here] primarily for the purpose of having a
appropriately highlighted source I can work on, such feature would
do perfectly fine for the purpose. I'd just need to switch (^W^W)
doing the editing in the respective (correctly highlighted) areas
of the same file. (But of course a pin-pointed syntax, preferable
without kludges, in a single window would be preferable.)

> I mean, I understand how you would want the AWK part of a shell script
> highlighted as if it were AWK, but would you really want the entire shell
> script highlighted that way?  I doubt that would look very good.

Right, that wouldn't look good. But the situation is that depending
on the setting either the shell or the awk wouldn't look good. We
can of course on-the-fly just ":set syntax=..." when working in the
respective area - and if we'd define some keys to make that complex
setting/typing bearable that may be a possible, or even a sensible,
workaround. For Shell/Awk I already have that specific script, but
for other such hybrid cases that macro-based syntaxes-switch might
actually be an option (and my thought about the feature obsolete).

PS: It might be necessary to emphasize that I typically don't have
just Awk-oneliners spread across the Shell code rather more complex
Awk functionality, so that's typically a block I can focus on. The
same situation with the other examples; embedded blocks of data, or
JS code that resides at the top of the HTML file in one block. - It
might be necessary to mention that we can of course often separate
the Awk or the JS or whatever embedded code in an own file and just
include that file; "problem" gone. But sometimes a monolithic file
is desired.

> 
>> Yes, exactly. - You'd also need to know vim's syntax-scripting. But
>> using the already existing syntax files - and just "combine" them,
>> or rather activate them - would need no individual vim-programming,
>> it would be just there.
> 
> There *is* a tool out there, that I learned about once on the VIM mailing
> list, that is sort of a "generic AWKembed" - i.e., it is supposed to handle
> any combination of languages.  But I looked at it and tried to figure it
> out - how to actually use it - and couldn't quite get it.  It just looked
> too complicated and I gave up.

Well, that's not surprising; the Net is full of solutions that are
more complex than necessary (or buggy, or cover just special cases,
or don't fit). That's, it seems, why people - me for sure - often
decide to write own solutions. (Of course there's also pearls of
software existing, and to be found.)

PPS: I recall another thought about that requirement I had posted
some time ago; to be able to define a sort of "modelines" anywhere
in the text, like "pragmas". That way I could not only change the
syntax highlighting in a block of text but also change indentation
for that area; the HTML/JS application case had made me ponder about
that back then.

Janis
Technical Details
Message-ID: <11a8bv1$2fkbe$5@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11a5t6k$2fkbe$3@dont-email.me> <11a63qf$35cge$1@news.xmission.com> <11a7c9o$2fkbe$4@dont-email.me> <11a85la$39ft2$1@news.xmission.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.editors
Subject: Re: Vim - set differing syntaxes in split view of the same source
 file?
Date: Thu, 8 Oct 2026 17:13:37 +0200
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <11a8bv1$2fkbe$5@dont-email.me>
References: <11a5t6k$2fkbe$3@dont-email.me>
 <11a63qf$35cge$1@news.xmission.com> <11a7c9o$2fkbe$4@dont-email.me>
 <11a85la$39ft2$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 08 Oct 2026 15:13:38 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2609518"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+H/eQKm12iANFDOMhd5VHu"; posting-host="23ea007eea66c34423c9a3219a9f8d24"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:VtP4gv9JXR7pOT49pAQ920cUCFw= sha256:3bXJCo2kfF/HuwFy9TTfzssNqlJ7lbD0YUaMwABZsLc=
	sha1:CRFjM7I40sL1mSGMqulgBGvsNZg= sha256:QTf1Aczu2t3JfAKpfy6NqvzLnRJqyvg6JhP/B+7Q9k8=
Content-Language: en-US
In-Reply-To: <11a85la$39ft2$1@news.xmission.com>