When I copy line three below in evil-mode
function foo() {
}
var bar; #copy
and paste it at line two, I get
function foo() {
var bar; #paste
}
instead of the correctly indented
function foo() {
var bar; #paste
}
I'd like to automatically indent my newly-pasted lines of code, and in vim, the fix for this is to remap the p
key to "nnoremap gp p`[v`]=".
I figured that I could use the following in my init.el
file to replicate the behaviour:
(fset 'paste-and-indent
"p`[v`]=")
(define-key evil-normal-state-map (kbd "p") 'paste-and-indent)
But when I try to use the code, upon pressing p
I get "After 0 kbd macro iterations: Lisp nesting exceeds 'max-lisp-eval-depth'."
I'm confused by this, as max-lisp-eval-depth
is set to 800
!
Can anyone offer advice on how to implement this behaviour in evil-mode emacs?