On 25/03/10 21:35, Jean Johner wrote:
Hello,
My .vimrc contains only
set nocompatible
set hidden
I do the following:
gvim file1
Put the cursor on line 10, colum 23
:e file2
:bp
Result: the cursor is positioned on line 10, column 1
I would like to include an autocmd command in my .vimrc so that the
cursor after the :bp is on line 10, column 23
I tried
autocmd BufEnter * exe "normal! g`'"
but it does not work.
Thank you for your help
Jean Johner
You want g`" not g`'
The autocommand defined for this purpose by the vimrc_example.vim is as
follows:
" 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
Best regards,
Tony.
--
"Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds."
-- J. Finnegan, USC.
--
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