incsearch.vim icon indicating copy to clipboard operation
incsearch.vim copied to clipboard

X11 mouse select and paste via middle button

Open noscript opened this issue 11 years ago • 8 comments

When I'm in the incsearch prompt, I cannot select text in vim buffer for latter pasting via middle button. Using middle button alone in the prompt doesn't work either.

noscript avatar Nov 04 '14 14:11 noscript

Hmm... sorry I didn't use mouse at all, so I didn't know how to select & yank & paste via middle button. Would you mind telling me detailed procedure or help doc I should read.

As for using middle button alone, I understood. I'll implement it. Thanks for the report @sergey-vlasov

haya14busa avatar Nov 05 '14 05:11 haya14busa

Yeah, if you don't use Linux you may not know about the issue. I will try to list all the problems:

  1. text selection from buffer with mouse doesn't work when being in prompt. I think this is reproducible in other OS. There is no use for that in Windows or OSX, but it's very handy in X11.
  2. In X11 there are two copy-paste buffers, PRIMARY and CLIPBOARD (Wikipedia). The CLIPBOARD one works just like in other OS via standard keyboard shortcuts. Text into the PRIMARY buffer gets by simply selecting it with mouse, then it's possible to paste via middle button. You can access PRIMARY in Vim from * register. I think it will be great if you allow custom bindings for prompt, so I could do something like:
map <MiddleMouse> <C-R>*
map <S-Insert> <C-R>+
map <C-V> <C-R>+

noscript avatar Nov 05 '14 10:11 noscript

Oh, I got it. Thanks for the explanation. :memo:

Maybe I'll add <MiddleMouse> mapping by default, but you can use :h IncSearchNoreMap like this.

Please write following lines into your vimrc

augroup incsearch-keymap
    autocmd!
    autocmd VimEnter * call s:incsearch_keymap()
augroup END
function! s:incsearch_keymap()
    IncSearchNoreMap <MiddleMouse> <C-R>*
    IncSearchNoreMap <S-Insert> <C-R>+
    IncSearchNoreMap <C-V> <C-R>+
endfunction

However, as for the selection with mouse, I think it's not easy to implement it, so please wait for a while.

haya14busa avatar Nov 05 '14 10:11 haya14busa

Hurray, problem 2. solved :) Thank you!

noscript avatar Nov 05 '14 10:11 noscript

Similar problem here, i can't paste the system clipboard content with the mapping <D-v> in MacVim :

augroup incsearch-keymap
    autocmd!
    autocmd VimEnter * call s:incsearch_keymap()
augroup END
function! s:incsearch_keymap()
    IncSearchNoreMap <C-v> <C-r>+
    IncSearchNoreMap <D-v> <C-r>+
endfunction

Pressing <D-v> insert the paste menu command : "+gP

harg avatar Dec 18 '14 10:12 harg

...? Maybe it's related with #35?

haya14busa avatar Dec 18 '14 10:12 haya14busa

oops sorry, didn't see this issue.

harg avatar Dec 18 '14 14:12 harg

Hi

I think I have a similar issue. I have the following mappings in my linux box.

map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
map <C-S-Insert> <MiddleMouse>
map! <C-S-Insert> <MiddleMouse>

It does not work with the following

map /  <Plug>(incsearch-forward)
map ?  <Plug>(incsearch-backward)

Thanks

justrajdeep avatar Mar 31 '17 14:03 justrajdeep