0

When editing Lisp or Clojure in Spacemacs (Emacs with Evil) I find the pasting behavior anoying. Say I have yanked bar and want to paste it as a parameter to (foo) so I get (foo bar). The problem is, I have to insert a space between o and ) before pasting or afterwards.

Is there a way to tell Spacemacs to automatically insert the space in Lisp/Clojure mode (with paredit) when pasting?

1

I don't know if there is a regular command for that (maybe there is one in the emacs-lisp state) but of course you could define your own custom function. e.g.

(defun custom-lisp-paste (&optional count)
  (interactive "*P")
  (forward-char)
  (insert " ")
  (evil-paste-after count))

And bind it to your prefered key. you could optionally add evil-forward-word-end before forward-char. I am using evil-paste-after and evil-forward-word-end here, but I think generally it is preferable to use the underlying Emacs functions directly. It is described in the Emacs lisp intro by Chassell how to insert text from the kill ring...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.