You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have been tinkering with your many incsearch plugins for a while trying to make them play nice with folding, and I have a few questions, observations if you can find the time to help me improve my configuration.
Reading issue #44, I have ended up adding 'zv' after all my 'incsearch-nohl-*' mappings, and it did improve the behavior, but I was not satisfied leaving all the buffer unfolded after navigating through the search matches. I finally added zx, and it got a little better to my taste (e.g. map n <Plug>(incsearch-nohl-n)zx ), now only the matches I jump to are unfolded, but my original fold view is still lost.
This leads me to <Over>(incsearch-*) mappings. For those, adding zv, or zx does not seem to have any effect, which makes sense as, to my understanding, the cursor is not actually moving to the matches. Unfortunately, this makes these very useful (to me) mappings much less useable.
What could make incsearch behave the way I would expect would be to unfold everything with a zn when starting a search, and restore original folding with zN when exiting the search, and, if the cursor moves to a folded match, add a zv to show it. This way, the <Over>* mappings will be useable, the folding restored, and the chosen match visible.
Following that idea, adding a zn to the incsearch mappings is easy, e.g. map / zn<Plug>(incsearch-forward). What is much trickier is to trigger the zN and zv on pressing <Cr>. The only lead I found for that could be the autocmd part of the help file and the IncSearchLeave or IncSearchExecute triggers.
As I am not familiar with vim script beyond hacking away at the config file, I would appreciate your input as to know if what I am trying to achieve is at all possible.
Thanks for taking the time.
The text was updated successfully, but these errors were encountered:
Hi, I have been tinkering with your many incsearch plugins for a while trying to make them play nice with folding, and I have a few questions, observations if you can find the time to help me improve my configuration.
Reading issue #44, I have ended up adding 'zv' after all my 'incsearch-nohl-*' mappings, and it did improve the behavior, but I was not satisfied leaving all the buffer unfolded after navigating through the search matches. I finally added zx, and it got a little better to my taste (e.g.
map n <Plug>(incsearch-nohl-n)zx
), now only the matches I jump to are unfolded, but my original fold view is still lost.This leads me to
<Over>(incsearch-*)
mappings. For those, addingzv
, orzx
does not seem to have any effect, which makes sense as, to my understanding, the cursor is not actually moving to the matches. Unfortunately, this makes these very useful (to me) mappings much less useable.What could make incsearch behave the way I would expect would be to unfold everything with a
zn
when starting a search, and restore original folding withzN
when exiting the search, and, if the cursor moves to a folded match, add azv
to show it. This way, the<Over>*
mappings will be useable, the folding restored, and the chosen match visible.Following that idea, adding a
zn
to the incsearch mappings is easy, e.g.map / zn<Plug>(incsearch-forward)
. What is much trickier is to trigger thezN
andzv
on pressing<Cr>
. The only lead I found for that could be the autocmd part of the help file and theIncSearchLeave
orIncSearchExecute
triggers.As I am not familiar with vim script beyond hacking away at the config file, I would appreciate your input as to know if what I am trying to achieve is at all possible.
Thanks for taking the time.
The text was updated successfully, but these errors were encountered: