eval in evil: move the cursor past last char
Hello, evil is awesome. 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? And virtualedit=onemore in vim does just that but I didn't find a reference to this in evil. Lorenz
Lorenz Köhl <[email protected]> writes:
Hello,
evil is awesome.
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. HTH, eric -- Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)
On 18 Sep 2011, Eric S. Fraga wrote:
Lorenz Köhl <[email protected]> writes:
Hello,
evil is awesome.
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.
Another option: eval in insert state. And there's `evil-move-cursor-back': Set to nil there's no mismatch between point and position in normal state. Michael
Michael Markert <[email protected]> writes:
On 18 Sep 2011, Eric S. Fraga wrote:
Lorenz Köhl <[email protected]> writes:
Hello,
evil is awesome.
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.
Another option: eval in insert state.
ah, true; I keep forgetting that the full emacs command set is available in insert state.
And there's `evil-move-cursor-back': Set to nil there's no mismatch between point and position in normal state.
This is very nice! Thanks. -- Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)
I wrote these functions for vimpulse. If you rewrite them for evil, send me a copy: (defun ny-eval-region-dwim () "Evaluates the current region if it exists. Otherwise evals the current line" (interactive) ;; if there is no region, select current line (when (not vimpulse-visual-mode) (progn (viper-beginning-of-line 1) (vimpulse-visual-toggle-line) (viper-goto-eol 1))) (eval-region (region-beginning) (region-end)) ;; de-activate visual mode (vimpulse-visual-mode -1)) (defun ny-eval-buffer () (interactive) (eval-buffer)) ;; sample mappings (vimpulse-map ",er" 'ny-eval-region-dwim) (vimpulse-map ",eb" 'ny-eval-buffer) Natan -- blog: http://natanyellin.com <http://natanyellin.com/>twitter: @aantn <http://twitter.com/aantn> On Sun, Sep 18, 2011 at 9:11 PM, Eric S Fraga <[email protected]> wrote:
Lorenz Köhl <[email protected]> writes:
Hello,
evil is awesome.
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.
HTH, eric
-- Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
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
participants (5)
-
Eric S Fraga -
Frank Fischer -
Lorenz Köhl -
Michael Markert -
Natan Yellin