clipboard=autoselect
It will be convenient if neovim can automatically send visual selection to clipboard (without yanking).
@bfredl will this be possible after #2077?
Not in #2077 #2244, but I plan to work on it after those are done (they are quite big PR:s already)
+1, I hope I can use set mouse=a to copy and paste to another application.
I think we should prioritize this for the next release, I've seen many reports about this: https://www.youtube.com/watch?v=yAqj8jupFws and here. I think people complain about us defaulting to mouse=a because of this aswell.
@fmoralesc I think setting mouse to anything instead of mouse=a is better than setting mouse=a because most people need to copy and paste it. It will also make mouse highlight ugly:

And hendry is in the video.
I hope to look into this the following days. I have read the vim implemention, but it relies heavily on the fact that vim "owns" the X11 selection, so that "updating" the selection is virtually effortless. We'll need to either invoke xsel on every visual mode keypress, or somehow detect reliably when nvim loses focus and update the selection then.
(Edit: the case of mouse selection is simpler, just update when the mouse is released)
Wow. When in commandline mode, vim actually emulates the "dumb" terminal selection (I mean selecting line numbers and terminal whitespace and everything), I always thought it just turned off mouse handling and let the terminal do it.
@bfredl Wow indeed. Do you plan to remove that?
@fmoralesc How, from vim? :) Well, I will start with visual mode selection as I suppose that whats most useful and simplest to implement.
Implementing autoselectml will probably require a lot more code written or ported from vim. Actually in cmdline mode in vim you can autoselect anything but the command line, and in command window mode autoselect and autoselectml seems to interfere with each other.
@bfredl LOL, I guess I wasn't paying enough attention :p
Hmm, what actually happens in vim, when visual mode and another x11 app wants to paste selection, is to save editor state,literally do "*y and then restore editor state so that it seems nothing actually happened (expect for updating * yankreg). Not sure if it simplest for us to do that too or to extract function to determine visual text contents without change any state...
It seems like nvim doesn't distinguish between mouse drag and mouse release events, at least not from observing do_mouse (I get first is_click, is_drag = true,false then false,true but never false,false). Just by testing with ttest the terminal do emit release events, but they aren't passed on in nvim somehow.
Seems regression from vim, just try :map <LeftRelease> anycommand works in vim but not nvim. Or select window by clicking on statusline (and not dragging).
+1 for this feature (clipboard=autoselect behaviour)
It's the main feature preventing me moving from vim to neovim.
I work on a linux desktop and expect to be able to select & paste using mouse left & middle buttons only (no keyboard). This works fine with vim (with guioptions=a & mouse=a), but sadly not with neovim.
@bfredl you said:
invoke xsel on every visual mode keypress
I don't think visual keyboard selection is such an issue. If I make a visual selection with the keyboard, I expect to have to yank (with the keyboard) to get it into the clipboard.
As you say:
the case of mouse selection is simpler, just update when the mouse is released
I'm hoping this is still possible ?
@lqueryvg, bfredl is now working on reimplementing the clipboard code without using the providers interface, see #4523.
Last time I checked, <LeftRelease> event (which would have allowed a swift resolution of the main issue) was broken :(. Time to check again...
(I mean one could have done vmap <LeftRelease> "*ygv (or a builtin equivalent thereof) and basically be done with it...)
If you need any help testing this, let me know.
Until this functionality is really built in via 'autoselect' one can still press the SHIFT key while using the mouse for selections. While SHIFT is pressed, vim/nvim does not capture mouse button events but lets the terminal handle them. So there is no need to turn off 'set mouse=a'.
See :help mouse in the vim/nvim docu.
@xeliba, it's true that most terminal emulators handle the mouse events themselves when you hold down Shift, but that's not much help when working with vim splits or line numbering.
If you need any help testing this, let me know.
vmap <LeftRelease> "*ygv did work for me with neovim-qt once I installed xsel.
Good to know :+1:
#3708 might work in the terminal in the meanwhile (even if very inefficient, and needs a rebase), but I hope to get #4523 in a testable/usable (but probably not mergable) state in the weekend or so.
Let me clarify. I came to this bug via the neovim-qt one. In my not so odd (hopefully⸮) set up, copy-and-paste works fine from the console. However, neovim-qt has no copy-and-paste at all. The above fix did work for neovim-qt and has not broken/changed the console behaviour.
+1 . I found this issue because it breaks visual mappings that rely on @*. SHIFT workaround is not useful in this scenario (but it is indeed in others!). This is the only handicap I have found while migration to neovim, so I have to say: great job!!! Please, if you need any help testing in different environments tell me (in my case, Linux Fedora).
@bfredl is there any progress on this feature ?
I would like to copy and paste from/to the clipboard with set mouse=a, I tried all combinations of set clipboard but it does not work.
I also tried to use this workaround: vmap <LeftRelease> "*ygv, but it does not work with set mouse=n or set mouse=a.
For info, I am compiling nvim with the latest sources. Thanks in advance, and thanks for working on this amazing project :)
I tried to switch to neovim again, and quickly encountered this. I'm still waiting for this to switch.
@lilydjwg The solution here does work fine. It is a work around but a simple one.
@kierun What about selecting with keyboard? Like ve vaw vi" vap V etc.
@lilydjwg It works fine for me. ☺ Try it out, it should take you less than five minutes to see if it is suitable or annoying for you.
@kierun No it doesn't work when I use keyboard to select.