Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joshtch opened this issue Apr 20, 2014 · 1 comment · May be fixed by #152
Open

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

joshtch opened this issue Apr 20, 2014 · 1 comment · May be fixed by #152

Comments

@joshtch
Copy link

joshtch commented Apr 20, 2014

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.

@justinmk
Copy link
Owner

Good ideas all around.

milsen added a commit to milsen/vim-sneak that referenced this issue Aug 3, 2015
Since vim-sneak does not work with the /-command but with the searchpos-function, the opening of folds must be done explicitly.
The skipping of the content of closed folds if &foldopen does not contain 'search' should also be implemented in the future. See justinmk#102.
milsen added a commit to milsen/vim-sneak that referenced this issue Aug 3, 2015
Sneaking now behaves like / when "foldopen-=search" is set: Closed folds
are considered to be single targets and are not opened when sneaking to
them. They are opened, however, when the default-&foldopen is used or
"foldopen+=search" is set; see a7f59bf.
Resolve justinmk#102.

This does not affect streak-mode (which still ignores &foldopen).
@milsen milsen linked a pull request Aug 3, 2015 that will close this issue
milsen added a commit to milsen/vim-sneak that referenced this issue Aug 4, 2015
milsen added a commit to milsen/vim-sneak that referenced this issue Nov 30, 2015
Sneaking now behaves like / when "foldopen-=search" is set: Closed folds
are considered to be single targets and are not opened when sneaking to
them. They are opened, however, when the default-&foldopen is used or
"foldopen+=search" is set.
Resolve justinmk#102.

This does not affect streak-mode (which still ignores &foldopen).
milsen added a commit to milsen/vim-sneak that referenced this issue Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants