is there left,right equivalents in evil or native emacs?

Wolfgang Jenkner wjenkner at
Thu Dec 22 06:28:08 CET 2011

Frank Fischer <frank.fischer at> writes:

> On Sat, Dec 17, 2011 at 06:32:03AM +0000, Jim Green wrote:
>> Hi, Frank and list:
>> in evil or emacs how to achive the following two commands?
>> :[range]ri[ght] [width]                                 :ri :right
>>                                                         :le :left
>> :[range]le[ft] [indent]
> But, of course, if there is some function doing this,
> it's not a real problem to bind them in ex-mode.

Just for the record...

#+begin_src emacs-lisp

(evil-define-operator evil-align-right (beg end type &optional width)
  "Right-align lines in the region at WIDTH columns.
The default for width is the value of `fill-column'."
  :motion evil-line
  :type line
  (interactive "<R><a>")
  (let ((fill-column (if width
			 (string-to-number width)
	adaptive-fill-mode fill-prefix)
      (narrow-to-region beg end)
      (goto-char (point-min))
      (while (progn
	       (justify-current-line 'right nil t)
	       (zerop (forward-line)))))))

(evil-ex-define-cmd "right" 'evil-align-right)


The following snippet would work as well, but it would also canonicalize

#+begin_src emacs-lisp

(evil-define-operator evil-align-right (beg end type &optional width)
  (let ((paragraph-start "")
	(paragraph-separate "$")
    (fill-individual-paragraphs beg end 'right)))



More information about the implementations-list mailing list