Monday, May 10, 2010

Re: Automatic sessions

On 11/05/10 05:43, sc wrote:
> On Monday 10 May 2010 8:38:38 pm Udo Hortian wrote:
>
>> recently I was using vim on a OpenSuse system. I found that
>> when I was editing a file with vim, closed vim and opened
>> this file again with vim, I found myself at the same position
>> in the file as before. I am not sure, but I guess this was
>> done via sessions. How can I get this working on my system
>> (Debian squeeze, vim 7.2.330-1)?
>
> it sounds to me as if the oS install had sourced the
> $VIMRUNTIME/vimrc_example.vim, which contains the following code:
>
> " 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
>
> you can either source that same file (dangerous in my opinion) or
> add the above code to your .vimrc
>
> hth,
>
> sc
>

I don't think it dangerous. Just check what it does: that file sets a
lot of useful settings; if there are some among them that you don't
like, you can override them after the :source or :runtime statement,
which should be near the top of your vimrc. For instance if you find
filetype-related autoindenting too "bossy" you can use

runtime vimrc_example.vim
filetype indent off

One exception: setting menus & messages languages (if desired) must be
done before the menus are set up, i.e., before invoking the
vimrc_example.vim (if you do, and before any ":filetype [plugin]
[indent] on" or ":syntax on" if you don't).


Best regards,
Tony.
--
The more things change, the more they stay insane.

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

No comments: