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

provide option to ignore concealed characters #30

Open
justinmk opened this issue Nov 20, 2013 · 6 comments
Open

provide option to ignore concealed characters #30

justinmk opened this issue Nov 20, 2013 · 6 comments

Comments

@justinmk
Copy link
Owner

A search may fail even though the visible text appears to be a match, because the actual text contains a concealed character that prevents the match. Maybe Sneak can provide an option to match only visible/non-concealed text.

@justinmk
Copy link
Owner Author

after some thought, this doesn't have many use cases and will be more confusing that helpful

@chiphogg
Copy link

I think there's actually a major use case: vim-dirvish.

The directory buffer in dirvish uses concealed text: each line contains the full path, but only the filename is visible. This can cause sneak to fail hard. In many cases, every line becomes a match. In fact, depending on the way folders are laid out, each line can effectively be multiple matches!

I think the confusion consideration cuts both ways on this one. When I use sneak, I'm usually jumping to something I can see. It was confusing at first to be jumping to lots of intermediate results, none of which were even visually highlighted. Now, of course, I understand how it works, and have for many years, so I'm used to it. But at some point, I realized that the thing I was initially trying to do (i.e., jump among visible results) might actually be the more desirable behaviour intrinsically. 🙂

@justinmk: WDYT about reopening and reconsidering this?

@ggandor
Copy link
Contributor

ggandor commented Mar 27, 2024

I think it would be best to set conceallevel to 0 on SneakEnter, and restore it on SneakLeave. It's not ideal, the sudden shift of characters is annoying, and might be disorienting, but still better than the confusing behavior of getting unexpected matches or worse, not jumping to an expected match.

Edit: nevermind, I forgot that Sneak actually uses conceal to display the labels (on Vim)

@justinmk
Copy link
Owner Author

justinmk commented Mar 27, 2024

I forgot that Sneak actually uses conceal to display the labels (on Vim)

Yeah, though not in Nvim 0.5+: 3ff1033

It probably makes sense to special-case dirvish buffers.

In any case, first need to figure out how to only search "visible" text.

@chiphogg
Copy link

I had a thought this morning: can we simply discard any matches after the fact, if it turns out that their text is completely concealed? (I have no idea how these things work, but if it's possible to tell whether text is or is not concealed, then we should be able to use this as a post-processing filter without needing to mess with the "core" search algorithm.)

@ggandor
Copy link
Contributor

ggandor commented Mar 27, 2024

It probably makes sense to special-case dirvish buffers.

It would be great for help files too. In fact, cannot think of a single situation where it would make sense to match hidden characters with such a jumping plugin (well, for label mode at least).

@justinmk justinmk reopened this Mar 27, 2024
@justinmk justinmk removed the invalid label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants