> On Thu, 18 Mar 2010, Jean Johner wrote:
>
> > On Mar 17, 6:36 pm, "Brian L. Matthews" <blmatth...@gmail.com> wrote:
> > > It works for me, but I might be restoring the cursor position
> >
> > Hi Brian,
> >
> > Adding your 8 lines of code in my .vimrc results in good
> > memorization of cursor column even on line 1.
> >
> > [...]
> >
>
> I can't speak for Brian, but in my (g)vim at work when I tested
> yesterday, it worked fine without anything like Brian's autocmd.
Turns out there's something in Gentoo's /etc/vim/vimrc that defeats
restoring the cursor column:
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif
OpenSUSE (at work) has the non-broken (abbreviated):
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
The difference in the executed commands is subtle:
g'"
versus
g`"
But, perhaps your distribution has something that uses (perhaps inadvertently)
'if line("'\"") > 1', for example. What system are you on, precisely?
Ubuntu (9.10) doesn't have any cursor restoration in its vimrc, AFAICT, for
example.
--
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
To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment