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

Optional folding when backward searching #2110

Closed
Eryx5502 opened this issue Jul 14, 2021 · 3 comments
Closed

Optional folding when backward searching #2110

Eryx5502 opened this issue Jul 14, 2021 · 3 comments

Comments

@Eryx5502
Copy link

Hi!

When using backward search (at least with zathura as viewer), the function vimtex#view#reverse_goto is used to jump to the correct location in the .tex. Right now this function perfoms a folding (with normal! zMzvzz), which folds some things out if folding is enabled.

It would be useful (at least to me) to be able to have folding enabled but not getting the fold status of the buffer changed when using backward search. I haven't found an option to modify this behaviour through the docs, so right now I have commented out the line doing the folding as a workaround.

@lervag
Copy link
Owner

lervag commented Jul 14, 2021

Hi!

Hi! :)

When using backward search (at least with zathura as viewer), the function vimtex#view#reverse_goto is used to jump to the correct location in the .tex. Right now this function perfoms a folding (with normal! zMzvzz), which folds some things out if folding is enabled.

I can see how this is opinionated! Perhaps it would be better to remove the normal! command and add an event that allows the user to customize this action?

E.g., to get the current behaviour, my suggestion implies that users would have to add something like this to their vimrc file:

augroup VimTeX
  autocmd!
  autocmd User VimtexReverseGoto normal! zvzz
augroup END

@Eryx5502
Copy link
Author

That sounds like a nice solution, and the posibility of further customization could be useful for some users.

Thanks for the awesome work!

lervag added a commit that referenced this issue Jul 14, 2021
Issued by vimtex#view#reverse_goto and allows more control of
what happens after reverse goto is performed.

refer: #2110
@lervag
Copy link
Owner

lervag commented Jul 14, 2021

Great, I've implemented this now. Let me know what you think. Notice the new example under :help VimtexEventViewReverse in the docs.

@lervag lervag closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants