Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VIM: locally import options at startup?

0 views
Skip to first unread message

Rui Maciel

unread,
Oct 8, 2009, 5:57:33 AM10/8/09
to
Is it possible to set up some sort of config file inside a directory
so that, when vim is ran in it, it picks up the config file and
imports all sort of options, from key maps to macros, specific to that
directory?


Thanks in advance,
Rui Maciel

Mikolaj Machowski

unread,
Oct 8, 2009, 9:50:41 AM10/8/09
to
Rui Maciel scripsit:

> Is it possible to set up some sort of config file inside a directory
> so that, when vim is ran in it, it picks up the config file and
> imports all sort of options, from key maps to macros, specific to that
> directory?

For example:

http://www.vim.org/scripts/script.php?script_id=441

m.
--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Vim Universal Templates: http://vim.sf.net/script.php?script_id=1078
CLEWN - http://clewn.sf.net

Florian Rehnisch

unread,
Oct 8, 2009, 10:32:39 AM10/8/09
to
o Rui Maciel <rui.m...@gmail.com>:

> Is it possible to set up some sort of config file inside a directory
> so that, when vim is ran in it, it picks up the config file and
> imports all sort of options, from key maps to macros, specific to that
> directory?

hmm, put a line in your vimrc:

autocmd BufEnter,BufNew /path/to/dir/* source /path/to/dir/mystuff.vim
--
flori
Vim-Hilfe auf Deutsch http://www.florianrehnisch.de/vimhelp/

James Michael Fultz

unread,
Oct 8, 2009, 11:38:47 AM10/8/09
to
* Mikolaj Machowski <mik...@wp.pl>:

> Rui Maciel scripsit:
>> Is it possible to set up some sort of config file inside a directory
>> so that, when vim is ran in it, it picks up the config file and
>> imports all sort of options, from key maps to macros, specific to that
>> directory?
>
> For example:
>
> http://www.vim.org/scripts/script.php?script_id=441

Or more simply, set 'exrc' and create a '.vimrc' in the desired
directory.

--
James Michael Fultz <xy...@sent.as.invalid>
Remove this part when replying ^^^^^^^^

Gary Johnson

unread,
Oct 8, 2009, 4:22:16 PM10/8/09
to
Rui Maciel <rui.m...@gmail.com> wrote:
> Is it possible to set up some sort of config file inside a directory
> so that, when vim is ran in it, it picks up the config file and
> imports all sort of options, from key maps to macros, specific to that
> directory?

If the 'exrc' option is set, vim will load the .vimrc (Unix) or _vimrc
(Windows) file in the current directory after it loads the system and
user vimrc files. See

:help startup

If you want the directory-specific config file to be loaded instead of
your user vimrc, then I think putting this near the top of your user
vimrc will work (untested):

if filereadable("config.vim")
so "config.vim"
finish
endif

where "config.vim" is just a name I chose as as an example.

--
Gary Johnson

0 new messages