Skip to content

Sneak doesn't skip hidden fold targets with set foldopen-=search #102

@joshtch

Description

@joshtch

set foldopen-=search makes searching not open folds. This is expected behavior, which sneak follows. However, if you look in the vim docs, with search off, searching will consider the fold to be a single target even if there are multiple matches within the fold. Sneak doesn't do this.

Minimal vim setup:

  1. Start vim with (see /u/welle's post on Reddit for an explanation here)
vim -Nu <(cat << VIMRC
set runtimepath+=~/.vim/bundle/vim-sneak/
set foldopen-=search
VIMRC)
  1. Type some random repeating text like
asdfasdfasdf
asdfasdfasdf
asdfasdfasdf
asdfasdfasdf
  1. Fold a few lines with ggzf3j or whatever
  2. sas
  3. ;;;;;; and your cursor doesn't move until all targets in fold have been encountered
  4. gg
  5. /af
  6. nnnn and your cursor moves immediately.

Also as a related issue, sneak should open folds when we have set foldopen+=search but it doesn't. Instead it behaves in the same undesirable way as set foldopen-=search.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions