farmergreg/vim-lastplace

Maintain Scroll Position

farmergreg opened this issue · 1 comments

It may be nice to try and restore the scroll position in addition to the last place that was edited. Various challenges would have to be dealt with including:

  • windows of different heights
  • scrolloff settings that are non zero
  • other??

A naive implementation could be realized by following this outline:

  • Ask the user set set viminfo+=! in their .vimrc
  • BufWinLeave: save line("w0") in a global variable that is persisted due to viminfo ! flag being set
  • BufWinEnter : jump to saved w0, then to '"

Thanks @oblitum for the idea