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

neovim with incsearch + easymotion paste problem. #158

Open hungrybirder opened 4 years ago

hungrybirder commented 4 years ago

HI, I got a problem. Command + v dosen't work well with incsearch. In normal mode , I type / and then type Command + v. It doesn't paste content to the nvim command line, instead paste the content into the buffer...

macOS 10.15.2
NVIM v0.4.3
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch-easymotion.vim'
Plug 'haya14busa/incsearch-fuzzy.vim'

if has('mac')
  let g:clipboard = {
    \   'name': 'macOS-clipboard',
    \   'copy': {
    \      '+': 'pbcopy',
    \      '*': 'pbcopy',
    \    },
    \   'paste': {
    \      '+': 'pbpaste',
    \      '*': 'pbpaste',
    \   },
    \   'cache_enabled': 0,
    \ }
endif

if has('clipboard')
  set clipboard& clipboard+=unnamedplus
endif

set hlsearch

let g:EasyMotion_smartcase = 1
nmap s <Plug>(easymotion-overwin-f)
nmap t <Plug>(easymotion-t2)
map <leader>j <Plug>(easymotion-j)
map <leader>k <Plug>(easymotion-k)
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
map  <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)

let g:incsearch#magic = '\v'
function! s:incsearch_config(...) abort
  return incsearch#util#deepextend(deepcopy({
  \   'modules': [incsearch#config#easymotion#module({'overwin': 1})],
  \   'keymap': {
  \     "\<CR>": '<Over>(easymotion)'
  \   },
  \   'is_expr': 0
  \ }), get(a:, 1, {}))
endfunction
noremap <silent><expr> /  incsearch#go(<SID>incsearch_config())
noremap <silent><expr> ?  incsearch#go(<SID>incsearch_config({'command': '?'}))
noremap <silent><expr> g/ incsearch#go(<SID>incsearch_config({'is_stay': 1}))

function! s:config_easyfuzzymotion(...) abort
  return extend(copy({
  \   'converters': [incsearch#config#fuzzy#converter()],
  \   'modules': [incsearch#config#easymotion#module()],
  \   'keymap': {"\<CR>": '<Over>(easymotion)'},
  \   'is_expr': 0,
  \   'is_stay': 1
  \ }), get(a:, 1, {}))
endfunction
noremap <silent><expr> <Space>/ incsearch#go(<SID>config_easyfuzzymotion())

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

echo "\" => <80><fc><80>v echo "\" => ^V

If there are something wrong in my init.vim, please let me know. Thank you.

lenkite commented 4 years ago

Wasted So much time, trying to find out which plugin amongst 400 was causing this issue. Thank you godly for this comment!

m-fonseca commented 4 years ago

I've disabled all plugins and removed all settings except for the '/' mapping. It looks like neovim with incsearch alone causes this problem for me.

itaiferber commented 3 years ago

Same here — this took quite a bit of time to track down. This appears to happen with just Neovim + incsearch.vim and terminal bracketed pasting (the default for iTerm2). It looks like disabling either map / <Plug>(incsearch-forward) or performing a non-bracketed paste (iTerm2 Advanced Paste [⌥⌘V] > disable Bracketed Paste Mode) leaves things working correctly.