I often do the following things:
- Copy text outside emacs
- Switch back to emacs, delete some text
- Paste
The problem is that I get back the deleted text since it overwrites the clipboard. To solve this problem, I added the following code in ~/.spacemacs
(defun dotspacemacs/user-config ()
(setq x-select-enable-clipboard nil)
(define-key evil-visual-state-map (kbd "s-c") (kbd "\"+y"))
(define-key evil-insert-state-map (kbd "s-v") (kbd "^R+"))
(define-key evil-ex-completion-map (kbd "s-v") (kbd "^R+"))
(define-key evil-ex-search-keymap (kbd "s-v") (kbd "^R+")))
Now the problem has gone, but I encountered a new problem because of those lines: I cannot paste text from the clipboard when pressing C-s RET
to search for words. When I press Cmd + V
(I use macOS) after pressing C-s RET
, I got text copied from Emacs instead of from the clipboard. How to solve that?