airblade / vim-gitgutter

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.
MIT License
8.37k stars 297 forks source link

Respect &foldopen during next/prev hunk jumps #890

Closed lukelbd closed 6 months ago

lukelbd commented 6 months ago

This makes the next/previous hunk block-style mappings respect the &foldopen setting by skipping zv if it does not contain the word 'block'.

Think this would be more consistent with other vim behavior, and since &foldopen contains 'block' by default it shouldn't affect the average user. However I can see the argument that this is a "breaking" change requiring an explicit setting like g:gitgutter_respect_foldopen (happy to update the PR if you feel this way).

Thanks for the awesome plugin!

airblade commented 6 months ago

This is great, thanks! Being as consistent as possible with other vim behaviour is always the goal.

Isn't 'foldopen' a global option? And therefore can't we just inspect &foldopen instead of &l:foldopen?

I don't think we need to introduce a new setting for this.

lukelbd commented 6 months ago

Great! And yep you're right it's global (didn't check) -- just force pushed a version with &foldopen

airblade commented 6 months ago

Brilliant, thanks again!