2

I am attempting to run emacs from within tmux (with emacs keybindings to avoid context switching) on Mac Os X and am having a real hard time getting copy/paste to work right. I am also attempting to configure tmux and emacs to both share their respective clipboards with the operating system.

the relevant sections of my tmux config:

set-option -g mouse on
set-option -g default-command "reatatach-to-user-namespace -l bash"
setw -g mode-keys emacs
bind-key -n -t emacs-copy M-w copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer"

And of my emacs config:

(setq x-select-enable-clipboard t x-select-enable-primary t)

This has the following effects:

1) I can copy and paste in my tmux with emacs buttons (M-w, C-y)

2) Whenever I attempt to select a region in my emacs (with C-Space for example), it also selects my line number from linum-mode

3) I can copy things that I select with my mouse inside emacs into my system clipboard AND the kill ring( e.g. selecting text with my mouse and hitting M-w causes me to be able to past in my browser/other applications with Command+V (I'm on a Mac) AND in emacs/tmux with C-y)

4) Selecting a region (with problem 2 baked in to boot) with C-Space and using either C-w or M-w, or just killing with C-k does not result in pastable result, either in the kill ring, or on the system clipboard.

Is there any way to fix problems 2/4 without getting rid of desirable properties 1/3?

Thanks so much!

Your Answer

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

Browse other questions tagged or ask your own question.