You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using the following code to remember cursor position when switching buffer:
au BufLeave * let b:winview = winsaveview()
au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif
it works if I use :bn or :bp to switch buffers. But it doesn't work with ctrlp. Is it that ctrlp isn't triggering those events or isn't triggering at the correct moment? I don't know. But I hope I could see my cursor at the original position when switching buffer with ctrlp. Thank you very much!
The text was updated successfully, but these errors were encountered:
Those autocmds work fine for me. I also use some autocmds to restore cursor position and folds and never had a problem.
Can you consistently reproduce this? If you can, please provide a test case including the buffers you have open, how you move away and reopen them with ctrlp.
@kien hi, sorry for bothering. After checking and experimenting with clean environment, I found its actually that the two lines of autocmd that is causing my cursor position to jump to the beginning of the buffer sometimes. After commenting out the two lines, everything works fine (though the cursor still jumps to the beginning of line each time when buffer is switched, but I guess this is a problem of vim itself). It looks strange but at least now it works. Thank you very much for your help and for creating such a beautiful plugin.
Hi, I'm using the following code to remember cursor position when switching buffer:
it works if I use :bn or :bp to switch buffers. But it doesn't work with ctrlp. Is it that ctrlp isn't triggering those events or isn't triggering at the correct moment? I don't know. But I hope I could see my cursor at the original position when switching buffer with ctrlp. Thank you very much!
The text was updated successfully, but these errors were encountered: