preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.09k stars 484 forks source link

Opening a file places cursor at top of file, overriding loadview autocmd #838

Open evanthegrayt opened 1 year ago

evanthegrayt commented 1 year ago

I have the following lines in my vimrc.

autocmd BufWritePost * if !(empty(expand('%')) || &buftype =~ 'nofile') | mkview | endif
autocmd BufReadPost * if !(empty(expand('%')) || &buftype =~ 'nofile') | silent loadview | endif

These lines load my views, which should allow me to open a file and place the cursor on the same line as the last time I edited the file. When I install this plugin, the autocmd triggers, but my cursor is still placed at the top of the file. I've also tried the restore_view plugin, and I get the same result.

After using git bisect, I found that the bug started in this commit, way back from 2011. It appears to be due to another autocmd being triggered on the SessionLoadPost event.