Tuesday, December 3, 2013

Re: setting different tw= for different parts of file

On 03/12/13 20:40, Konrad Delong wrote:
> Hi,
>
> I don't seem to be able to google it up. Is there a way of setting a different textwidth (tw=) for different parts of the file (eg. based on the highlight semantics)?
>
> My specific use case is Python code in which I would like to allow the import lines to extend the textwidth limit (and still automatically apply it to all other lines).
>

Short answer: You can't: Vil hasn't got that feature.
Long answer: see below.


When you need info about the behaviour of Vim, don't trust Google, trust
the help. The online help for Vim documents all and every behaviour
pattern. See

:help
:help :help
:help helphelp

for help about searching the help, because with such an abundant
documentation, you would easily get lost if you didn't know how to ask
your way. But even that is documented.


When I started using IBM-PC computers, long before Windows even existed,
I used a nifty little editor called ED.EXE (and whose "commercial" name
was PC-Write). It was distributed by copying diskettes and giving them
to friends; and if you wanted the next release you could send $5.00 to
the author. That editor had the feature that you could define a whole
"ruler line", with left margin, right margin, bell column, variable
tabs, columns for text, for digits, for skipping, whatever, and you
could place new such "ruler lines" anywhere in the text. That would have
answered your question.

Alas, AFAIK PC-Write has gone with the snows of yesteryear (or of
yester-decade, rather), and Vim hasn't got that feature. With Vim, you
cannot set a left margin, and you can only set text width once per
document. You can set it in a modeline if you want (see ":help
modeline"), but such a modeline, which must be placed either near the
top or near the bottom of a file, applies to the whole file.


You can get behaviour similar to what you're asking for, either by using
some WYSIWYG "text processor" (which Vim isn't) or by writing in HTML,
which can be done by means of Vim if you know the language, and in
particular how to define your <div>s and your <p>s, with all their
possible attributes, in order to get various text widths for various
parts of the document when looking at it in a browser, or when printing
it. Giving tutorship about HTML is of course off-topic on this list, but
there is excellent documentation both online and on printed paper, and
the official HTML standards (which, however, can be arduous to read and
understand) are maintained by the W3C anf the WHATWG.


Best regards,
Tony.
--
Really heard in court in the U.S.A.:
Q.: Doctor, how many of your autopsies were on deceased persons?
A.: All of them. Living people struggle too much.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment