Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Sorry. I just realized this sentance makes no sense :) -- Ian Main


computers / comp.editors / [vim] Musings about modeline settings by section

SubjectAuthor
o [vim] Musings about modeline settings by sectionJanis Papanagnou

1
[vim] Musings about modeline settings by section

<u7ka5e$26p7q$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=15&group=comp.editors#15

  copy link   Newsgroups: comp.editors
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.editors
Subject: [vim] Musings about modeline settings by section
Date: Thu, 29 Jun 2023 18:06:06 +0200
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <u7ka5e$26p7q$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Jun 2023 16:06:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8eaa048ae6e50294b32773700e54e6f1";
logging-data="2319610"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JB68QeTIUP5j5VlrwRdas"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:2Hk4IkXxZ1/p44+NNOfjqMa76u4=
X-Mozilla-News-Host: news://news.eternal-september.org:119
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 29 Jun 2023 16:06 UTC

Can some settings like 'syntax' or 'shiftwidth' be defined section
wise?

It's not uncommon that I have different data types in a file; e.g.
(a) Javascript in a HTML file, (b) Awk in a Shell file, (c) HTML
or other languages' source code in a Shell's "heredoc", etc.[*]
Usually I want different settings (typically ts, sw, syntax, ai)
depending on where (in which section) I am in such heterogeneous
files.[**]

Vim's modelines can be externally defined, or embedded at the
beginning or at the end of an individual file.

In some programming languages we have "pragmas" supported, where
the (preprocessor-, compiler-, interpreter-, linker-) setting may
change details of processing behavior from section to section.

(Global settings like the vim modelines and such pragmas are of
course different things. Just thinking about possibilities here.)

What would an appropriate way (=workaround) be to handle section
wise settings; if it is possible in the first place. Could it be
combined with folding sections, maybe? Another thought is to use
a split window and define separate settings in each sub-window;
but that kludge also doesn't work, currently. Or use some sort
of markup tags?

Ideas and thoughts, general or specific, workarounds or ideas
for feasible functions (for the future) are welcome.

(Or is there already such a vim feature existing that I just
missed?)

How do you work with heterogeneous files?

Janis

[*] I am aware that there are workarounds; for (a) we can put
the Javascript code in a separate file, for (b) we can, e.g.,
adjust the vim syntax file to support the embedded awk syntax.
But sometimes it is unavoidable or just convenient to have all
in one file, which is the point of my post.

[**] I am also aware that there may be editor operations that
get too complicated by such a feature; thinking of edits that
involve more than one section and may be influenced by some
settings. Some file specific global settings may not qualify
to differ per section; such cases must be thought of as well.
Settings would have to be differentiated by their type then.


computers / comp.editors / [vim] Musings about modeline settings by section

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor