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

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

Open
evanthegrayt opened this issue Oct 19, 2022 · 0 comments

Comments

@evanthegrayt
Copy link

evanthegrayt commented Oct 19, 2022

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.

@evanthegrayt evanthegrayt changed the title Opening a file jumps to top of file, even after loadview autocmd Opening a file places cursor at top of file, overriding loadview autocmd Jan 16, 2023
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

1 participant