Monday, March 22, 2010

Re: How to remember end of line when quitting/reopening in insert mode

> if has('autocmd')
> augroup vimrcEx
> " When editing a file, always jump to the last known cursor position.
> " Don't do it when the position is invalid or when inside an event
> " handler (happens when dropping a file on gvim).
> " Also don't do it when the mark is in the first line, that is
> " the default position when opening a file.
> autocmd BufReadPost *
> \ if line("'\"") > 1 && line("'\"") <= line("$") |
> \ exe "normal! g`\"" |
> \ endif
> augroup END
> endif

Shouldn't the line("'\"") > 1 be > 0? Otherwise if the cursor is
positioned on line 1, it won't move it to the correct column (the
example in :help last-position-jump uses exe "normal! g'\"" so it
already isn't using the column, so in that case > 1 is fine as there's
no need to move the cursor from line 1 to line 1).

Brian

--
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: