Re: is there left,right equivalents in evil or native emacs?
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]
Well, there may be Emacs commands doing this (though I'm not aware of them) but no matter if they exist or not, they are definitely not available as Evil (ex-)commands. But, of course, if there is some function doing this, it's not a real problem to bind them in ex-mode. Frank
On 17 December 2011 14:39, Frank Fischer <[email protected]> wrote:
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]
Well, there may be Emacs commands doing this (though I'm not aware of them) but no matter if they exist or not, they are definitely not available as Evil (ex-)commands. But, of course, if there is some function doing this, it's not a real problem to bind them in ex-mode.
Thanks! Jim
Frank Fischer <[email protected]> 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) fill-column)) adaptive-fill-mode fill-prefix) (save-restriction (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) #+end_src The following snippet would work as well, but it would also canonicalize whitespace. #+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))) #+end_src Wolfgang
participants (3)
-
Frank Fischer -
Jim Green -
Wolfgang Jenkner