Wednesday, February 2, 2011

Re: Sourcing an arbitrary vimscript right after all vimrc files have been executed?

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

Not AFAIK as a command line option.

Nonetheless, let me present to you a strategy:

* use --cmd to set up a BufReadPre autocmd, which will be triggered when
starting to edit a buffer but before the file is read into the buffer
* have the BufReadPre autocmd do whatever it is you want and then to
remove itself

Regards,
Chip Campbell

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