On 2026-06-13 00:22, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 2026-06-11 22:40, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 2026-06-10 01:29, Keith Thompson wrote:
[...]
The par program by default does not format text the way
Lumin Etherlight does. They might be using par with options.
"par -j" formats paragraphs by inserting spaces so the text is
right-justified. "par -j -w50" does the same, but with 50-character
lines. I don't see an option to insert two leading spaces on
each line.
(I'm a bit astonished that Vim doesn't natively support that. -
Or does it, and I just don't know about it?)
It does, and I didn't know about it either. "gq" followed by a
motion command formats text, possibly using a configured external
program. ":help gq" in vim for more information. (I've been using
key mappings to invoke "fmt" since before I'd even heard of vim.)
Oh, I obviously was unclear. - I had been talking about the
left-and-right block-alignment; the format we saw in Lumin's post.
'fmt' does *not* support that functionality. But 'par' *does*.
No I don't think you were unclear. I use "fmt" rather than
"par" because (a) "par" probably didn't exist when I started
using "fmt" (and I'm not sure "vim" did), and (b) I don't *want* left-and-right-justified text. I'm now aware that vim has a built-in
feature for formatting paragraphs, but as Darth Vader would say,
"The intertia is strong with this one".
Then we were (and probably still are!) talking at cross purposes.
I had been asking for a built-in 'par' like function; there isn't
one. (And I thought you had been trying to support my request with
the hints to 'fmt' in your post. - So *I* probably misinterpreted
your post as being an answer to my question.)
I also don't like block-formatting for posts. But it's useful for
specific purposes, and since it's an common editing/presentation
task it should (as Vim's 'gq') be a Vim built-in, in my opinion.
('gq' I'm actually using with Vim already for a very long time.
It's very useful and easy to type and use.)
Both can be used from within Vi or Vim with its _external filter_
interface. But both are not *natively* supported in Vi. And 'gq'
in Vim supports *native* formatting like 'fmt', but not like 'par'.
You can also configure external commands. But my question was about
a "native" support; because I like editing functions independent
of environmental support, and I don't like plugins (which would be
another options for those who think plugins are a good idea).
Quoting the vim documentation:
"""
JUSTIFYING TEXT *justify* *:Justify* *Justify()* *package-justify*
Vim has no built-in way of justifying text.
Vim has 'gq' formatting natively; see point 3. below (:help gq).
gq{motion} Format the lines that {motion} moves over.
Formatting is done with one of three methods:
1. If 'formatexpr' is not empty the expression is
evaluated. This can differ for each buffer.
2. If 'formatprg' is not empty an external program
is used.
3. Otherwise formatting is done internally.
In my standard Vim environment, the settings of 1. and 2. are empty.
So internal (native) formatting is used.
However, there is a neat macro
package that does the job. To use this package, execute the following command: >vim
:packadd justify
Or put this line in your |vimrc|: >vim
:packadd! justify
"""
Yes, and this is plugin! - I said that I don't like to use plugins.
I use Vim *natively* with what it comes; it's extremely powerful as
it is already, and I want to avoid dependencies like external 'par'
commands or any plugins!
I've got an answer to my original "native block-formatting question"
("Or does it, and I just don't know about it?") also from the Vim
mailing list:
There is no built-in command but there is a plugin distributed
with vim. See ":help justify".
So I'm fine with my curiosity about that. And we can close the topic
(at least as far as my question goes). :-)
Janis