Closed lacygoill closed 6 years ago
Ah, after thinking about this a little more, I suspect the issue does not come from the plugin but from a limitation inside Vim. Maybe I should try to write a wrapper to temporarily disable folds.
Edit:
This seems to work:
set fdm=marker
set rtp+=~/.vim/plugged/vim-sneak
fu! s:visual_sneak(fwd) abort
let fen_save = &l:fen
let &l:fen = 0
call feedkeys("\<plug>Sneak_".(a:fwd ? ';' : ','), 'it')
call timer_start(0, {-> execute('let &l:fen ='.fen_save.'|norm! zv')})
return ''
endfu
map f <plug>Sneak_f
map F <plug>Sneak_F
nmap ; <plug>Sneak_;
nmap , <plug>Sneak_,
xmap <expr> ; <sid>visual_sneak(1)
xmap <expr> , <sid>visual_sneak(0)
vim --version
: VIM - Vi IMproved 8.0 Included patches: 1-1257$TERM
: screen-256colorAfter remapping
f
to<Plug>Sneak_s
, and pressing;
while in visual mode, as soon as the next match is inside a fold, instead of moving to the latter, it seems the cursor moves to the end of the fold. And it's impossible to get back to a match before the fold by pressing,
.Here's a minimal
vimrc
to reproduce:Start Vim like this:
Press:
zM
to make sure the fold is closedf=
to move the cursor on the next equal sign, afterfdm
v
to enter visual mode;
to move the end of the selection to the next equal signThe cursor should move to the equal sign, right after
set rtp+
, and you should be able to move the end of the selection between the 2 equal signs. Instead the cursor is stuck on the end of the fold.