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

Incsearch doesn't open folds #44

Closed rgrinberg closed 9 years ago

rgrinberg commented 9 years ago

If the next matching result is inside a fold the fold should be opened.

haya14busa commented 9 years ago

It already handle to open a fold after search execution.

You mean <Over>(incsearch-next)(default <Tab>)? Please give me a more detail information.

rgrinberg commented 9 years ago

No I mean the default n mapping. Mine is mapped correctly to <Plug>(incsearch-nohl-n) but it doesn't seem to open folds. The only exception is the first search once I hit <CR> which does open folds.

haya14busa commented 9 years ago

:h 'foldopen'

NOTE: When the command is part of a mapping this option is not used. Add the |zv| command to the mapping to get the same effect. (rationale: the mapping may want to control opening folds itself)

Oh, I got it. Please see :h 'foldopen'. It's compatible with default n behavior.

haya14busa commented 9 years ago

I handled to open fold only for / & ? enhancement mappings unlike default one because you cannot add a zv mapping to them.

rgrinberg commented 9 years ago

That's strange because my foldopen seems correct as it includes search.

haya14busa commented 9 years ago

Please read this part.

NOTE: When the command is part of a mapping this option is not used. Add the |zv| command to the mapping to get the same effect. (rationale: the mapping may want to control opening folds itself)

rgrinberg commented 9 years ago

OK thanks I get it.

aemonge commented 6 years ago

So what should I remap my config to get the zv to open on default search ?

partial config

    Plug 'haya14busa/incsearch.vim'                                            " Improved incremental searching for Vim
      Plug 'haya14busa/incsearch-fuzzy.vim'
      Plug 'haya14busa/incsearch-easymotion.vim'
      Plug 'Lokaltog/vim-easymotion'                                             " Easy motion
      set hlsearch
      let g:incsearch#auto_nohlsearch = 1
      let g:EasyMotion_smartcase = 1
      map n  <Plug>(incsearch-nohl-n)
      map N  <Plug>(incsearch-nohl-N)
      map *  <Plug>(incsearch-nohl-*)
      map #  <Plug>(incsearch-nohl-#)
      map g* <Plug>(incsearch-nohl-g*)
      map g# <Plug>(incsearch-nohl-g#)
      function! s:config_easyfuzzymotion(...) abort
        return extend(copy({
        \   'converters': [incsearch#config#fuzzy#converter()],
        \   'modules': [incsearch#config#easymotion#module()],
        \   'is_expr': 0,
        \   'is_stay': 1,
        \   'smart_case': 1
        \ }), get(a:, 1, {}))
      endfunction
      noremap <silent><expr> / incsearch#go(<SID>config_easyfuzzymotion())
      noremap <silent><expr> ? incsearch#go(<SID>config_easyfuzzymotion({'command': '?'}))
hanyk commented 4 years ago
map n  <Plug>(incsearch-nohl-n)zv
map N  <Plug>(incsearch-nohl-N)zv