Neovim-qt: Select/copy/paste support?

Created on 28 Aug 2017  路  13Comments  路  Source: equalsraf/neovim-qt

Hi, is it possible or are there any plans to add select/copy/paste support (Windows 10)? Ie. being able to select text within nvim-qt.exe, ctrl+c/ctrl-v/mouse clicks etc.? gVim does this and it's helped me a lot!

Cheers!

Ref. [Windows 8.1] clipboard support? https://github.com/equalsraf/neovim-qt/issues/123

Most helpful comment

:set mouse=a

ctrl+c/ctrl-v

Those are just mappings. Try :behave mswin Try:

:source $VIMRUNTIME/mswin.vim

All 13 comments

:set mouse=a

ctrl+c/ctrl-v

Those are just mappings. Try :behave mswin Try:

:source $VIMRUNTIME/mswin.vim

Thanks man, but still I can't seem to copy or paste, whether it's with my keyboard or with my mouse.

Ref. https://unix.stackexchange.com/questions/139578/copy-paste-for-vim-is-not-working-when-mouse-set-mouse-a-is-on

To replicate the regular copy-and-paste behaviour on Linux, I had to put the following settings in ginit.vim:

set mouse=a

" Paste with middle mouse click
vmap <LeftRelease> "*ygv

" Paste with <Shift> + <Insert>
imap <S-Insert> <C-R>*

No dice on Windows :/

The mswin.vim example should enable Ctrl+c and Ctrl+v. Testing here with nvim from master and it is working with nvim-qt. It is also working in the terminal UI.

Maybe there is some other issue at play here. @frankie-loves-jesus is any kind of copy pasting to the system clipboard working for you?

Thanks guys - I can confirm mswin.vim enables Ctrl+c and Ctrl+v 馃憤

Copy/pasting with the mouse with set mouse=a however seems to be more challenging: https://stackoverflow.com/questions/4608161/copy-text-out-of-vim-with-set-mouse-a-enabled. Apparently it requires that you hold in Shift while selecting. A side-effect of this is that you also have to press Ctrl+c / Ctrl+v multiple times for it to have any effect. Nowhere near as smooth as in gVim. Thoughts?

Apparently it requires that you hold in Shift while selecting

No. That post is for _terminal_ Vim. Lots of confusion and misinformation flying around, because Vim is so inconsistent.

A side-effect of this is that you also have to press Ctrl+c / Ctrl+v multiple times for it to have any effect. Nowhere near as smooth as in gVim. Thoughts?

@equalsraf Does nvim-qt handle mousemodel=popup[_setpos]? Is there something missing in Nvim for that?

@frankie-loves-jesus Try this:

:set mousemodel=popup

(we need to make this the default...)

@equalsraf Does nvim-qt handle mousemodel=popup[_setpos]? Is there something missing in Nvim for that?

We dont have any specific support for menus or the popup yet.

Is the popup supposed to work in the terminal, like the pum? I cant get it to trigger (quick side note menu.vim is not sourced by default, but this does not fix it)

Is the popup supposed to work in the terminal, like the pum?

No, but it's something I've been thinking about.

@lihuelworks What is "this"? Did you try the suggestions above? What exactly did you try?

:set mouse=a

ctrl+c/ctrl-v

Those are just mappings. ~Try :behave mswin~ Try:

:source $VIMRUNTIME/mswin.vim

Interestingly, while similarly trying with macmap.vim, it didn't work.
Until I have changed all the to where x stands for any char.

The

set mouse=a
source $VIMRUNTIME/mswin.vim

Did the trick for me. I included those in my init.vim. I was able to use CTRL+c/CTRL+v to copy and paste from and to neovim. I was kind of expecting the same right-click menu like gVim has for Windows, but this works too.

I was kind of expecting the same right-click menu like gVim has for Windows, but this works too.

Pull Request #539 adds support for a basic right-click context menu similar to gVim in recent versions. I need to add some documentation for the feature...

ginit.vim:

nnoremap <silent><RightMouse> :call GuiShowContextMenu()<CR>

inoremap <silent><RightMouse> <Esc>:call GuiShowContextMenu()<CR>

vnoremap <silent><RightMouse> :call GuiShowContextMenu()<CR>gv
Was this page helpful?
0 / 5 - 0 ratings