How can I set text width and formatting a paragraph?
Hi, The following is what I'm doing in Vim. I would like to do the same in Emacs Evil-mode. I am working in Org-mode: 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 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. 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. 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. I would like to be able to do this in Emacs Evil-mode. I am using Emacs 24 on Debian Jessie (Raspbian Jessie Lite) on a Raspberry Pi, and I'm using Emacs Org-mode. I work via SSH. Below is my .emacs in case it provides any useful info for you to help me. Thank you in advance for any hint or info. Hector. ~/.emacs (add-to-list 'load-path "~/.emacs.d/evil") (setq evil-want-C-i-jump nil) (require 'evil) (evil-mode 1) (global-visual-line-mode 1) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(org-agenda-files nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. )
Hector A. Abreu <[email protected]> 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).
participants (2)
-
Dmitry Alexandrov -
Hector A. Abreu