Thursday, April 1, 2010

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

Hi Andy,
One (last?) suggestion to improve lastpos.vim

1) Consider a .vimrc containing the following 2 lines:
set insertmode
imap <F8> <C-\><C-O>:bprevious<CR>

Please do the following:
gvim file1
CTRL-O :e file2
put the cursor at the end of line 10
<F8>
put the cursor at the end of line 10 (in file1)
Use <F8> several times
You see that the end of lines are remembered (Good)

2) Just add "set hidden" in the .vimrc
set insertmode
set hidden
imap <F8> <C-\><C-O>:bprevious<CR>

Please do the following:
gvim file1
CTRL-O :e file2
put the cursor at the end of line 10
<F8>
put the cursor at the end of line 10 (in file1)
Use <F8> several times
You see that only line numbers are remembered. The cursor is always on
column 1.

Can you improve that?

Hint: Using vimrc_example.vim as .vimrc (without lastpos.vim), the
same problem occurs in normal mode. The solution is to replace
BufReadPost with BufWinEnter in vimrc_example.vim.

Best regards
Jean Johner

--
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, reply using "remove me" as the subject.

No comments:

Post a Comment