🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #4

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

#4
From: Kenny McCormack
Date: Thu, 08 Oct 2026 13:26
46 lines
3086 bytes
In article <11a7c9o$2fkbe$4@dont-email.me>,
Janis Papanagnou  <janis_papanagnou+ng@hotmail.com> wrote:
...
>> I have sometimes been in the situation of wanting to open the same file
>> twice but force VIM to treat them as separate buffers.  I have not tried
>> very hard, but it would be worth testing making a link (either hard or
>> soft) and opening that in a separate window (and hoping it gets a new
>> buffer assigned to it).

FWIW, I did some testing and could not find a way to make VIM create a new
buffer for the same file.  I tried linking (both soft and hard), even tried
"mount --bind".  There's probably other things I could try, but it seems
pretty determined not to let you do it.

Of course, then it occurred to me that the easy way is just to open a new
tab/window/whatever and :r the file.  Then you'll have the contents of the
file, but it won't be associated with the original file.

>>> [*] Yet I achieve the desired behavior by having a separate but
>>> specific vim syntax-code in $HOME/.vim/after/syntax/sh/awkembed.vim

BTW, I may be mis-understanding the overall goal here.

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.

>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.

>I thought I just ask for a second opinion. - Thanks!

BAU!

-- 
Indeed, most .NET developers couldn't pass CS101 at a third-rate
community college.
		- F. Russell -
Technical Details
Message-ID: <11a85la$39ft2$1@news.xmission.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
References: <11a5t6k$2fkbe$3@dont-email.me> <11a63qf$35cge$1@news.xmission.com> <11a7c9o$2fkbe$4@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.editors
Subject: Re: Vim - set differing syntaxes in split view of the same source
 file?
Date: Thu, 8 Oct 2026 13:26:02 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <11a85la$39ft2$1@news.xmission.com>
References: <11a5t6k$2fkbe$3@dont-email.me> <11a63qf$35cge$1@news.xmission.com> <11a7c9o$2fkbe$4@dont-email.me>
Injection-Date: Thu, 8 Oct 2026 13:26:02 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
	logging-data="3456930"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)