eval in evil: move the cursor past last char
Frank Fischer
frank.fischer at mathematik.tu-chemnitz.de
Tue Sep 20 11:19:37 CEST 2011
On Sun, Sep 18, 2011 at 07:11:22PM +0100, Eric S Fraga wrote:
> > As I was customizing to make my vim and emacs habits non-exclusive I
> > realized that C-x C-e (eval-last-sexp) works on the next to last sexp
> > and I couldn't move over the last paren as it's usually the last
> > character.
> >
> > How do you eval in evil?
>
> I was just going to ask the same question! The problem is the mismatch
> between emacs point and vi's character position.
>
> In any case, the solution is quite straightforward: put the cursor
> (point) at the start of the next line. Not ideal but it works.
You may try the following code which advices some function when evil
is activated. If you use at least 35ff006 those modifications should
be activated if and only if evil is active. If those modifications
work they could go into evil's code.
;;; eval-last-sexp
(defadvice eval-last-sexp (around evil)
"Last sexp ends at point."
(when (evil-normal-state-p)
(save-excursion
(unless (or (eobp) (eolp)) (forward-char))
ad-do-it)))
;;; pp-eval-last-sexp
(defadvice pp-eval-last-sexp (around evil)
"Last sexp ends at point."
(when (evil-normal-state-p)
(save-excursion
(unless (or (eobp) (eolp)) (forward-char))
ad-do-it)))
Frank
More information about the implementations-list
mailing list