reddit / emacs

Making `*` register work in Evil mode in terminal Emacs on macOS

linty-org · 2022-04-14 20:54
I am running Evil mode under Doom in a terminal Emacs on macOS. My `*` Vim register doesn't seem to be hooked up to the system clipboard. (Normally in Vim if you yank to `"*` your text goes into the system clipboard, and you can also paste from the system clipboard by pasting from `"*`.) Is there a way to make the `*` register work?
pwnedary · 2022-04-15 07:13
Check out [xclip](https://elpa.gnu.org/packages/xclip.html#:~:text=GNU%20ELPA%20%2D%20xclip,-xclip&text=This%20package%20allows%20Emacs%20to,for%20the%20package%20to%20work.) (or Doom may have something of its own...).
linty-org · 2022-04-15 14:38
How do you get xclip to connect the `*` register to the system clipboard?
pwnedary · 2022-04-15 15:33
Edit: Try using the `+` register instead of `*`. It may be that only that one works. Should be sufficient to just enable `xclip-mode`. select-enable-clipboard nil ; Do not tie unnamed register "" to system clipboard (xclip-mode) is the all I have in [my](https://github.com/axelf4/dotfiles/blob/00a67dfb397c2da50f2cfad2fe4f813924eefc20/.config/emacs/init.el#L111) config, and I remember it working just fine back when I had to use a Mac.
linty-org · 2022-04-15 16:08
TYVM. The following worked for me: - Install `xclip`. (Add `(package! xclip)` to `packages.el`, then `doom sync`, then `M-x doom/reload`.) - By default, this makes it so that normal yank/delete/put uses the system clipboard, which is not what I want. - Then, in `config.el`: ``` (xclip-mode) ; Turn on xclip-mode by default. (setq select-enable-clipboard nil) ; Do not tie the unnamed register to the system clipboard. ``` As you said, `*` does not work, but `+` does, and `+` also works in Vim/Neovim, so I am content to learn to use `+` everywhere. Thanks again!
pwnedary · 2022-04-15 16:15
Yup. IIRC `*` is for X primary selection and the like, while `+` is for system clipboard; so `+` is the proper one for this purpose, even more so on macOS.