<div dir="ltr">I wrote these functions for vimpulse. If you rewrite them for evil, send me a copy:<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><br></div><div>
(defun ny-eval-region-dwim ()</div><div> "Evaluates the current region if it exists. Otherwise evals the current line"</div><div> (interactive)</div><div> ;; if there is no region, select current line</div><div>
(when (not vimpulse-visual-mode)</div><div> (progn</div><div> (viper-beginning-of-line 1)</div><div> (vimpulse-visual-toggle-line)</div><div> (viper-goto-eol 1)))</div><div> (eval-region (region-beginning) (region-end))</div>
<div> ;; de-activate visual mode</div><div> (vimpulse-visual-mode -1))</div><div><br></div><div>(defun ny-eval-buffer ()</div><div> (interactive)</div><div> (eval-buffer))</div></div><div><br></div><div>;; sample mappings</div>
<div><div>(vimpulse-map ",er" 'ny-eval-region-dwim)</div><div>(vimpulse-map ",eb" 'ny-eval-buffer)</div></div><div><br></div></blockquote><div><br clear="all"><div dir="ltr"><div>Natan</div><div>
<br></div><div><span style="border-collapse:collapse;color:rgb(136, 136, 136);font-family:arial, sans-serif;font-size:13px"><div>--</div><div>blog: <a href="http://natanyellin.com/" style="color:rgb(87, 151, 176)" target="_blank">http://natanyellin.com</a></div>
<div><a href="http://natanyellin.com/" style="color:rgb(87, 151, 176)" target="_blank"></a>twitter: <a href="http://twitter.com/aantn" style="color:rgb(87, 151, 176)" target="_blank">@aantn</a></div></span></div></div><br>
<div class="gmail_quote">On Sun, Sep 18, 2011 at 9:11 PM, Eric S Fraga <span dir="ltr"><<a href="mailto:e.fraga@ucl.ac.uk" target="_blank">e.fraga@ucl.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Lorenz Köhl <<a href="mailto:rainbowtwigs@googlemail.com" target="_blank">rainbowtwigs@googlemail.com</a>> writes:<br>
<br>
> Hello,<br>
><br>
> evil is awesome.<br>
><br>
> As I was customizing to make my vim and emacs habits non-exclusive I<br>
> realized that C-x C-e (eval-last-sexp) works on the next to last sexp<br>
> and I couldn't move over the last paren as it's usually the last<br>
> character.<br>
><br>
> How do you eval in evil?<br>
<br>
I was just going to ask the same question! The problem is the mismatch<br>
between emacs point and vi's character position.<br>
<br>
In any case, the solution is quite straightforward: put the cursor<br>
(point) at the start of the next line. Not ideal but it works.<br>
<br>
HTH,<br>
eric<br>
<font color="#888888"><br>
--<br>
Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)<br>
<br>
<br>
_______________________________________________<br>
implementations-list mailing list<br>
<a href="mailto:implementations-list@lists.ourproject.org" target="_blank">implementations-list@lists.ourproject.org</a><br>
<a href="https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list" target="_blank">https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list</a><br>
</font></blockquote></div><br></div></div>