On Wed, 2 Feb 2011, Dun Peal wrote:

Hi.

I read about the -S command line flag, as well as the --cmd flag.

Problem is, I need to source an arbitrary vimscript right after all vimrc files have been read, but before the first file has been read. So --cmd is too early for me, while -S is too late.

What I need is a flag --foo, such that:

   vim --foo bar.vim

Would act as if the following line has been appended to ~/.vimrc:

   source bar.vim

Does such a thing exists?

Here's what I do to set up an 'alpine' (mail client) mode (essentially adds an extra conditionally-sourced file at the end of .vimrc):

At end of .vimrc:

if exists("g:alpine")
        " do alpine-specific stuff
endif

Then, invoke Vim as: vim --cmd 'let g:alpine=1'

Modified for sourcing an arbitrary file:

At end of .vimrc:

if exists("g:extrasource")
        exe "source ".g:extrasource
endif

Invoke as:
" careful of 'special' chars in filename (including spaces)
vim --cmd 'let g:extrasource='./path/to/extra.vim

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

Reply via email to