Comment 3 for bug 673680

Revision history for this message
marbertone (marbertone-deactivatedaccount) wrote : Re: [Bug 673680] Re: vim hangs loading 100%

perhaps you're right.
The script I added is the following:

" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
" when we reload, tell vim to restore the cursor to the saved position
augroup JumpCursorOnEdit
au!
autocmd BufReadPost *
\ if expand("<afile>:p:h") !=? $TEMP |
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ let JumpCursorOnEdit_foo = line("'\"") |
\ let b:doopenfold = 1 |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo -
1)) |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
\ let b:doopenfold = 2 |
\ endif |
\ exe JumpCursorOnEdit_foo |
\ endif |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ exe "normal zv" |
\ if(b:doopenfold > 1) |
\ exe "+".1 |
\ endif |
\ unlet b:doopenfold |
\ endif
augroup END

which used to work under Karmic, but not anymore under Maverick. I will
try that, even if I can assure you the bug happened just two/three
times, hence I don't know with which probability I'll be able to
reproduce the bug.

Anyway... how to tell Vim to remember cursor position?
Cheers,
Mario Alberto

Il 12/11/2010 22:21, James Vega ha scritto:
> If you could confirm whether this happens when starting Vim in the
> following ways, that should help narrow down whether this is a bug in
> Vim or some script that is loaded.
>
> 1) vim -u NONE -N testfile
> 2) vim -u NORC -N testfile
> 3) vim --noplugin -N testfile
> 4) vim -u /etc/vim/vimrc -N testfile
>
> Also, attaching the problematic file (or another one that exhibits the
> same behavior if the original has sensitive information) would help
> attempts to reproduce the problem.
>