How can I set text width and formatting a paragraph?

Dmitry Alexandrov 321942 at
Fri Jun 3 20:41:32 CEST 2016

Hector A. Abreu <habreu71 at> writes:

> 1) In Vim I set the number of columns that I want for a specific paragraph
> that I will highlight to re-format:
> :set tw=72
> PROBLEM: In Emacs Evil-mode I get this message: State tw=72 cannot be set
> as initial Evil state

Yes, this does not seem to work.  And I have to admit, that have no idea
whether it should — unfortunately Evil is not as well documented as
GNU Emacs itself.

But you could always use native key sequence: ‘M-72 C-x f’ (mnemonics:
‘f’ for ‘fill’) or ‘M-x set-fill-column RET 72’ is you prefer command
line over key sequences.

> 2) In Vim I highlight the paragraph with Visual mode (V and then j or k).
> Works ok in Emacs Evil-mode.
> 3) In Vim I type gq to put all the lines of the paragraph within the limits
> set on step 1.

By the way, why not just ‘gqap’?

> In Emacs Evil-mode apparently is putting the lines within
> the limits of step 1, but I am not sure since step 1 showed the message
> mentioned on step 1 for Emacs Evil-mode.

It apparently does not.

> 4) In Vim I type :runtime macros/justify.vim in order to be able to
> highlight the paragraph, and with _j put all the lines of the highlightd to
> end at the exact column number set on step 1, so the paragraph can look
> straight and aligned in the right margin. Nothing of this will work in
> Emacs Evil-mode, I guess because the Vim macros will not work.

You do not need external macros to justify paragraph in Emacs, it’s
built-in feature: ‘M-1 M-q’ (instead of ‘1’ you may use any other
number; and ‘M-q’ without prefix means fill without justify).

More information about the implementations-list mailing list