Hey Ben
I think you give me the right hint I have this autocmd in my _vimrc
autocmd BufReadPost *\ if line("'\"") > 0 && line("'\"") <= line("$") |\ exe "normal g`\"" |\ endif
so is it replacable by the autocmd you gave
au BufReadPost * normal g`"
2011/10/26 Benjamin R. Haskell <vim@benizi.com>
On Wed, 26 Oct 2011, Eddine wrote:To me it looks like it's a malfunctioning autocmd, which doesn't anticipate being called when it's being called. (Pretty sure 'autoread' doesn't kick in in Insert mode.)HiI had this strange behavior again this afternoon, so I was editing a file, that was being modified by a java process who was writing in it.And I don't know what happens (maybe a mousse scroll or something like that) and the whole part before the line is erased and I got : g`" instead.I have been able to take a picture with my phone (they are so paranoid in my firm that I avoided to make a screenshot sent by email) it can be seen here:I tried :redraw, CTrl-L nothing to do.The strange thing is that the file is not written, cause when I close it vim doesn't ask me if I want to save, and re-opening bring it back to me.Any ideas ?As pointed out in::help g`g`"jumps to the last known position in a file. So, it's commonly added to systemwide /etc/vimrc autocmds so that opening a file again will start you in the same place you were at when you last stopped editing it.A common example is included in the example rc, IIRC. On Gentoo, it's:" [...inside augroup gentoo]" When editing a file, always jump to the last cursor positionautocmd BufReadPost *\ if ! exists("g:leave_my_cursor_position_alone") |\ if line("'\"") > 0 && line ("'\"") <= line("$") |\ exe "normal g'\"" |\ endif |\ endifNot sure, but I think this one would be okay regardless of the context. Maybe you have something simpler, like:au BufReadPost * normal g`"Or maybe you have some other command that tries to reread the buffer, even when in Insert mode. (Which then triggers the bad behavior of the other command.)--Best,Ben--You received this message from the "vim_use" maillist.Do not top-post! Type your reply below the text you are replying to.For more information, visit http://www.vim.org/maillist.php
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment