mattboehm / vim-accordion

A vim window manager for people who love splits
101 stars 3 forks source link

AccordionAll 2 scrolls the screen right unnecessarily sometimes #35

Open svermeulen opened 10 years ago

svermeulen commented 10 years ago

The biggest source of frustration for me with this plugin is that often times I'll open a new vertical split only to find that the previous split I was in has been scrolled to the point where I can't really see the text I was working with, forcing me to jump back to the previous split and adjust the horizontal scroll.

Repro steps:

mattboehm commented 10 years ago

Thanks for reporting, I'll look into this. When windows get squished, their scroll changes so I try to use winsaveview() and winrestview() to work around this issue, but there must be a bug with it.

svermeulen commented 10 years ago

I also noticed that this issue occurs when creating a new tab. The following fixes that:

    autocmd WinEnter * normal! 80zh

But doesn't address the problem outlined above when creating new splits (since it's the previous window with the bad scroll not the new one)

svermeulen commented 10 years ago

Found a better workaround in the function accordion#Accordion

"jump to prevwin and back so that window history is preserved
execute prevwin "wincmd w"
normal! 100zh
execute curwin "wincmd w"
normal! 100zh

Obviously a bit hacky though.

mattboehm commented 10 years ago

Thanks, that helps. My main things to consider are if this alienates people that had the view intentionally scrolled to the right. I'd also need to ensure that the solution works with any number of windows and accordion size. If the best end solution still feels a bit hacky though, worst case, I make it an optional setting.