Dear list! I'm a bit confused about Evil's interaction with the clipboard. When I set x-select-enable-clipboard to t, visual selections are copied to the clipboard as well as yanked and deleted text. However, when I set x-select-enable-clipboard to nil, neither visual selections nor yanked and deleted text are copied to the clipboard. Both behaviors seem inconsistent with what other applications do under the X window system. My understanding is that visual selections should go into the primary selection while yanked and deleted text should go to the clipboard. Is it possible to configure Evil to behave this way? My googling didn't turn up anything useful. Titus
If the aim is to behave like vim, then visual selections should go to the primary selection, text yanked into the + register should go into the clipboard and text yanked into the * register should go to the primary selection. I've had no problems getting text to the clipboard/primary selection with the + and * registers; I don't use visual mode much so haven't tried that out. -Jason On December 22, 2013 8:48:27 AM PST, Titus von der Malsburg wrote:
Dear list!
I'm a bit confused about Evil's interaction with the clipboard. When I set x-select-enable-clipboard to t, visual selections are copied to the clipboard as well as yanked and deleted text. However, when I set x-select-enable-clipboard to nil, neither visual selections nor yanked and deleted text are copied to the clipboard. Both behaviors seem inconsistent with what other applications do under the X window system. My understanding is that visual selections should go into the primary selection while yanked and deleted text should go to the clipboard. Is it possible to configure Evil to behave this way? My googling didn't turn up anything useful.
Titus
On 22.12.2013 17:48, Titus von der Malsburg wrote:
Dear list!
I'm a bit confused about Evil's interaction with the clipboard. When I set x-select-enable-clipboard to t, visual selections are copied to the clipboard as well as yanked and deleted text. However, when I set x-select-enable-clipboard to nil, neither visual selections nor yanked and deleted text are copied to the clipboard. Both behaviors seem inconsistent with what other applications do under the X window system. My understanding is that visual selections should go into the primary selection while yanked and deleted text should go to the clipboard. Is it possible to configure Evil to behave this way? My googling didn't turn up anything useful.
I have no idea ;) I remember that we fought a little bit with this selection stuff. It gets even more complicated because MacOS, Windows and X all behave differently and Emacs (and Evil) has to deal with all of them. Could you please test the attached patch? However, I'm not sure if it causes other problems ... ;) Frank
[email protected] writes:
I remember that we fought a little bit with this selection stuff. It gets even more complicated because MacOS, Windows and X all behave differently and Emacs (and Evil) has to deal with all of them.
Frank, thank you for this patch, this looks very promising. I just tested it with the customizations listed below and it works pretty much as I think it should: selecting text via the mouse of visual mode copies the active region to primary but not to the clipboard. Yanking or deleting text copies it to the clipboard and to primary. (setq x-select-enable-primary t) (setq x-select-enable-clipboard t) (setq select-active-regions t) (setq mouse-drag-copy-region t) However, I also agree with Jason: the current behaviour of Evil seems to be consistent with Vim (when I set x-select-enable-clipboard to nil) and it allows me to copy text to the clipboard by sending it to the + register. While I think that compatibility is important, it's precisely the possibility to deviate from Vim's behavior what makes Evil so useful, at least for me. Thus, the best solution would perhaps be to make this configurable: there should be a way to get Vim's default behavior. Alternatively, it should be possible to send yanked and deleted text to the + register by default. I guess this would require a different solution than the one in the patch. Namely one in which yank and delete operators are modified instead of evil-visual-update-x-selection. A special case is evil-delete-char (bound to x in normal mode). If I use that command, a single character is copied to the clipboard. My guess is that this is hardly ever desired: why would I type C-v for pasting a single character in another application when I could simply type that character directly? Thus it would perhaps be better to exclude evil-delete-char from the commands that copy to the clipboard, unless the user explicitely asks for it by specifying the + register. Titus
On Mon, Dec 23, 2013 at 11:59 AM, Titus von der Malsburg <[email protected]
wrote: (...)
A special case is evil-delete-char (bound to x in normal mode). If I use that command, a single character is copied to the clipboard. My guess is that this is hardly ever desired: why would I type C-v for pasting a single character in another application when I could simply type that character directly? Thus it would perhaps be better to
(...) You forget one of the oldest and most used (at least by me) idioms in Vim: xp for transposing the character under the cursor with the one that follows ;-) Cheers, -- José A. Romero L. [email protected] "We who cut mere stones must always be envisioning cathedrals." (Quarry worker's creed)
José, I wasn't talking about Evil's internal clipboard. The terminology is a bit confusing, at least under the X window system. By saying clipboard I was referring to the clipboard that is used for copying text between applications, say from Evil to your web browser. When you press x in Vim and then Ctrl-v in your web browser, the pasted text is not the character that was deleted by the x operation because x usually doesn't copy to the general system-wide clipboard. The same goes for other yank and delete operations (unless you send stuff to the + register). My proposal, was to change Evil to copy yanked and deleted text to the system-wide clipboard by default but to exclude x from that because copying single characters is not a common use case. Of course, I don't want to change how the x operator works inside Evil and xp should always work the way you descibe it. Titus
participants (4)
-
Frank Fischer -
Jason Miller -
José A. Romero L. -
Titus von der Malsburg