现象
1、yank后,在sublime或者Alfred里 cmd+v,粘贴不上。
解决
参考:https://github.com/syl20bnr/spacemacs/issues/2222
把下面这段代码,粘贴到.spacemacs最后面,用space+o+y就可以凑合用了。
(cond
;; OS X
((string-equal system-type "darwin") ; Mac OS X
(progn
(setq save-to-clipboard-cmd "pbcopy")
(setq paste-from-clipboard-cmd "pbpaste")
)
)
;; Linux
((string-equal system-type "gnu/linux") ; linux
(progn
(setq save-to-clipboard-cmd "xsel -i -b")
(setq paste-from-clipboard-cmd "xsel -o -b")
)
)
)
(defun copy-to-clipboard ()
"Copies selection to x-clipboard."
(interactive)
(if (display-graphic-p)
(progn
(message "Yanked region to x-clipboard!")
(call-interactively 'clipboard-kill-ring-save)
)
(if (region-active-p)
(progn
(shell-command-on-region (region-beginning) (region-end) save-to-clipboard-cmd)
(message "Yanked region to clipboard!")
(deactivate-mark))
(message "No region active; can't yank to clipboard!")))
)
(defun paste-from-clipboard ()
"Pastes from x-clipboard."
(interactive)
(if (display-graphic-p)
(progn
(clipboard-yank)
(message "graphics active")
)
(insert (shell-command-to-string paste-from-clipboard-cmd))
)
)
(evil-leader/set-key "o y" 'copy-to-clipboard)
(evil-leader/set-key "o p" 'paste-from-clipboard)
转载请注明:牛哥678 » spacemacs: 不能粘贴到系统粘贴板clipboard