Created
January 20, 2015 09:14
-
-
Save v2e4lisp/5c63aa1dfba0c6392cba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; copy to clipboard from emacs in terminal | |
;; | |
;; if you use emacs in tmux you should enable pbcopy in tmux first | |
;; http://superuser.com/questions/231130/unable-to-use-pbcopy-while-in-tmux-session | |
;; | |
;; (require 'region-bindings-mode) | |
(defun pbcopy-region (start end) | |
(interactive "r") | |
(pbcopy (buffer-substring start end)) | |
(set-mark-command t)) | |
(defun pbcopy (string) | |
(let ((cmd (concat "echo " (shell-quote-argument string) " | pbcopy"))) | |
(call-process-shell-command cmd nil t))) | |
(define-key region-bindings-mode-map (kbd "M-RET") 'pbcopy-region) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment