haya14busa / incsearch.vim

:flashlight: Improved incremental searching for Vim
https://medium.com/@haya14busa/incsearch-vim-is-dead-long-live-incsearch-2b7070d55250
MIT License
1.11k stars 23 forks source link

X11 mouse select and paste via middle button #29

Open noscript opened 9 years ago

noscript commented 9 years ago

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.

haya14busa commented 9 years ago

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

noscript commented 9 years ago

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>+
haya14busa commented 9 years ago

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.

noscript commented 9 years ago

Hurray, problem 2. solved :) Thank you!

harg commented 9 years ago

Similar problem here, i can't paste the system clipboard content with the mapping 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 insert the paste menu command : "+gP

haya14busa commented 9 years ago

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

harg commented 9 years ago

oops sorry, didn't see this issue.

justrajdeep commented 7 years ago

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