On Sat, Mar 20, 2010 at 03:03:42AM -0700, Jean Johner wrote: > On Mar 19, 3:16 pm, James Vega <[email protected]> wrote: > > This is expected behavior. See ":help 'startofline". You'll likely > > want to ":set nostartofline" for the behavior you desire. > > Hi James, > Setting "nostartofline" solves the problem, but it results in keeping > the cursor column also for CTRL-F, gg ... which in my opinion is not > natural. > > Presently, the situation is as follows: > 1) > set sol (default) > set nohidden (default) > autocmd g`" in .vimrc (default .vimrc)
Which is run on BufReadPost (if it's the autocmd listed at ":help last-position-jump"). That happens here because when 'nohidden' is set and you switch buffers, the buffer is unloaded. When you switch back to that buffer, it is re-read from disk, therefore the BufReadPost autocmd is executed. > Result: the cursor column is remembered with :bprevious > > 2) > set sol (default) > set hidden (to be able to edit a new buffer without > saving) > autocmd g`" in .vimrc (default .vimrc) In this situation, the BufReadPost autocmd isn't being run because the buffer is still in memory. You could try also running the autocmd on BufEnter in order to achieve your desired behavior. > Result: the cursor column is NOT remembered with :bprevious Note that there is no "default" vimrc. There's an example vimrc that's shipped with Vim and some Linux distributions provide a system-wide vimrc that is sourced before the user's vimrc. -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
signature.asc
Description: Digital signature
