place all vim configs into config directory[unix]

1,219 views
Skip to first unread message

Alex QR

unread,
Mar 14, 2011, 11:08:43 AM3/14/11
to vim_dev
Hello!

Pls add support for $XDG_CONFIG_HOME variable.
In short term $XDG_CONFIG_HOME is where all configs should be
(standard by freedesctop.org) and normaly points to ~/.config

so structure that I wish to see is like that:

.config/vim
.config/vim/doc
.config/vim/vimrc
.config/vim/autoload
.config/vim/colors
.config/vim/plugin
.config/vim/viminfo
etc.

Also the I want to accentuate that vimrc (form my point if vision of
course) should be in .config/vim directory. It seen logical to mi if
all vim configuration files will be in the same directory.

Thanks.

Alex QR

unread,
Mar 14, 2011, 11:19:59 AM3/14/11
to vim_dev
A I would like to try to make this changes myself by changing
directory, backupdir, viminfo and runtimepath. So I am searching them.
But would be nice if somebody point me where they are.

Charles Campbell

unread,
Mar 14, 2011, 11:03:01 AM3/14/11
to vim...@googlegroups.com
Why not just set your VIMRUNTIME variable? Something like

export
VIMRUNTIME="$HOME/.config/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.config/vim/after"

Regards,
Chip Campbell

Alex QR

unread,
Mar 14, 2011, 12:36:36 PM3/14/11
to vim_dev
>export VIMRUNTIME="$HOME/.config/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.config/vim/after"

Thx, I actually did find some solution that works with
$XDG_CONFIG_HOME, but I will tray with $VIMRUNTIME to achieving a
cleaner solution.

Problem is that some people like my wish for a native solution)))
$VIMRUNTIME is fun, but there already is $XDG_CONFIG_HOME for all.

Peter Odding

unread,
Mar 14, 2011, 1:24:10 PM3/14/11
to vim...@googlegroups.com
Hi Alex,

> Problem is that some people like my wish for a native solution)))
> $VIMRUNTIME is fun, but there already is $XDG_CONFIG_HOME for all.

The freedesktop.org initiative was launched in 2000 while Vim was
originally released in 1991 and the freedesktop.org initiative only
applies to a small percentage of Vim users because Vim has been ported
to dozens of platforms. Why do you feel the default Vim configuration
should respect $XDG_CONFIG_HOME? (or am I misinterpreting you?)

- Peter Odding

Benjamin R. Haskell

unread,
Mar 14, 2011, 2:26:39 PM3/14/11
to vim...@googlegroups.com

I took it to mean that there should be an easy way to configure Vim (at
compile time) to default to using $XDG_CONFIG_HOME directories. I sent
a patch to that effect (minus the configuration portion -- wasn't sure
if it made more sense to call it --with-xdg-directories or
--enable-xdg-directories -- probably the latter?).

As to the initial problem, I'm pretty sure there's a way to configure it
to use $XDG_CONFIG_HOME already, but it seems better to have a way to
"bundle" those options, since more and more Linux distros are moving
toward these recommendations.

But, I agree 100% that it should *not* be the default configuration.

Alex, you might try doing something like what my patch is doing in code,
if you want this now. Something along the lines of:

$ CPP_FLAGS="-DUSR_VIMRC_FILE=\"\$XDG_CONFIG_HOME/vim/vimrc\" -DUSR_EXRC_FILE=\"\$XDG_CONFIG_HOME/vim/exrc\"" ./configure [various options] && make

--
Best,
Ben

Benjamin R. Haskell

unread,
Mar 14, 2011, 2:27:07 PM3/14/11
to Vim Dev, v...@benizi.com
Freedesktop defines some commonly, but certainly-not-universally used
directories for configuration (rather than using $HOME/.file, it's generally,
$XDG_CONFIG_HOME/appname/file). This is a very rough first draft of using
those names if XDG_DIRECTORIES is defined.


vim.patch

xxx

unread,
Mar 14, 2011, 3:22:53 PM3/14/11
to vim_dev
In a related note I would like to have to following:

If a .vimrc does not exist in $HOME then look use $HOME/.vim/vimrc if
it exists.
This would make it more uniform than having .vimrc in unix and _vimrc
in windows.

Alex QR

unread,
Mar 15, 2011, 7:55:39 AM3/15/11
to vim_dev
Hello Peter,

Let me say it another way. Of course "should" is not what I mean. I
just sought that it would be nice if vim could optionally respect
$XDG_CONFIG_HOME, because it would make easier working with configs.
So in short words it is all like Benjamin said.

Tom Sorensen

unread,
Mar 15, 2011, 4:02:30 PM3/15/11
to vim...@googlegroups.com
On Mon, Mar 14, 2011 at 3:22 PM, xxx <inac...@gmail.com> wrote:
> In a related note I would like to have to following:
>
> If a .vimrc does not exist in $HOME then look use $HOME/.vim/vimrc if
> it exists.
> This would make it more uniform than having .vimrc in unix and _vimrc
> in windows.

You can use .vimrc in Windows just fine, and vim will pick it up with
absolutely no configuration on your part. The only reason it looks for
_vimrc is because of a stupid decision by MS to not allow Explorer to
create files with a leading "." .

Note that Windows vim will NOT look for ~/.vim by default though --
this is a bigger issue for those using the same config on Windows and
other platforms. You have to change rtp near the top of your .vimrc.
And, of course, if .vimrc was inside of .vim then it would be an
impossible situation.

Tom

Gary Johnson

unread,
Mar 15, 2011, 4:57:36 PM3/15/11
to vim...@googlegroups.com
On 2011-03-15, Tom Sorensen wrote:

> Note that Windows vim will NOT look for ~/.vim by default though --
> this is a bigger issue for those using the same config on Windows and
> other platforms. You have to change rtp near the top of your .vimrc.
> And, of course, if .vimrc was inside of .vim then it would be an
> impossible situation.

I don't think Vim's use of ~/vimfiles on Windows and ~/.vim on Unix
should be an issue when using the same configuration on both OSs.
Vim automatically sets 'rtp' as needed for either OS. The ~/.vimrc
or ~/_vimrc doesn't need to know where plugins are located and the
plugins don't need to know, either. Vim would be able to find
~/vimfiles/vimrc or ~/.vim/vimrc as easily as it finds the user's
plugins.

I'm currently sharing the same configuration among two Windows
machines and two Linux machines and the only issue I've had is with
the Windows Vim thinking that RCS/*.vim,v files should be sourced as
plugins. I don't do any modification of 'rtp'.

I also have Cygwin running on one of those Windows boxes and for
that, I keep the real plugins in ~/vimfiles and just have a Cygwin
symbolic link from ~/.vim to ~/vimfiles.

Regards,
Gary

Tony Mechelynck

unread,
Mar 16, 2011, 1:43:22 AM3/16/11
to vim...@googlegroups.com, Tom Sorensen
On 15/03/11 21:02, Tom Sorensen wrote:
> On Mon, Mar 14, 2011 at 3:22 PM, xxx<inac...@gmail.com> wrote:
>> In a related note I would like to have to following:
>>
>> If a .vimrc does not exist in $HOME then look use $HOME/.vim/vimrc if
>> it exists.
>> This would make it more uniform than having .vimrc in unix and _vimrc
>> in windows.
>
> You can use .vimrc in Windows just fine, and vim will pick it up with
> absolutely no configuration on your part. The only reason it looks for
> _vimrc is because of a stupid decision by MS to not allow Explorer to
> create files with a leading "." .
>
> Note that Windows vim will NOT look for ~/.vim by default though --
> this is a bigger issue for those using the same config on Windows and
> other platforms.

Oh, but it will: see the following a few lines below :help _vimrc

> Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist,
> "_vimrc" is also tried, in case an MS-DOS compatible file
> system is used. For MS-DOS and Win32 ".vimrc" is checked
> after "_vimrc", in case long file names are used.
> Note: For MS-DOS and Win32, "$HOME" is checked first. If no
> "_vimrc" or ".vimrc" is found there, "$VIM" is tried.

IOW, on Unix ~/.vimrc is looked for first, and ~/_vimrc if it isn't
found. On Windows the order is ~/_vimrc, ~/.vimrc, $VIM/_vimrc,
$VIM/.vimrc (and if there is also a $VIM/vimrc it is a "system vimrc",
normally loaded before, not instead of, the user's vimrc on any system).

> You have to change rtp near the top of your .vimrc.
> And, of course, if .vimrc was inside of .vim then it would be an
> impossible situation.
>
> Tom
>

Best regards,
Tony.
--
"Every man has his price. Mine is $3.95."

Bram Moolenaar

unread,
Mar 18, 2011, 9:18:33 AM3/18/11
to Benjamin R. Haskell, Vim Dev

Ben Haskell wrote:

How widespread is this? Is this something new or established?

It's always possible to do things differently, but usually doing it the
old way is better so long as it's not running into real problems. Also,
more compilation options make things more complicated.

--
A special law prohibits unmarried women from parachuting on Sunday or she
shall risk arrest, fine, and/or jailing.
[real standing law in Florida, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Benjamin R. Haskell

unread,
Mar 18, 2011, 3:36:56 PM3/18/11
to Bram Moolenaar, Vim Dev
On Fri, 18 Mar 2011, Bram Moolenaar wrote:

>
> Ben Haskell wrote:
>
>> Freedesktop defines some commonly, but certainly-not-universally used
>> directories for configuration (rather than using $HOME/.file, it's
>> generally, $XDG_CONFIG_HOME/appname/file). This is a very rough
>> first draft of using those names if XDG_DIRECTORIES is defined.
>
> How widespread is this?

Depends on what's on your system. It's up to applications to use the
dirs or not.

On my Gentoo system, I've got 124 ~/.{application}/ dirs and 18
~/.{application}rc files, but I have 22 ~/.config/{application}/ dirs.

At work, it's 89, 19, and 16.

The relevant Freedesktop.org standard(s) have backing from GNOME, KDE,
and Xfce, but I don't tend to use any of those for my WM, so I tend not
to have many extra GNOME/KDE programs installed.

The only things I use regularly that use the XDG directories are XMMS2
and Chrome/Chromium. But I don't think I'm a typical Linux user (based
solely on my choice of WM: wmii).

Qt- and GNOME-based apps appear to use it.


> Is this something new or established?

Maybe becoming established?

v 0.5 was 2004.
v 0.7 (current) was 2010.


> It's always possible to do things differently, but usually doing it
> the old way is better so long as it's not running into real problems.
> Also, more compilation options make things more complicated.

Right.

--
Best,
Ben

James Vega

unread,
Mar 18, 2011, 5:45:46 PM3/18/11
to Vim Dev

With this patch, if $XDG_CONFIG_HOME isn't set (which is the common
case) Vim would need to know to use ~/.config. This could likely be
done like $VIM is, where the environment is checked first and a default
used if it isn't set.

--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jame...@jamessan.com>

signature.asc

Alex QR

unread,
Mar 19, 2011, 7:22:17 AM3/19/11
to vim_dev
>How widespread is this? Is this something new or established?

it is freedesktop.org standard, at list this programs support this
standard:

ls -1
dconf
Empathy
eog
evince
evolution
gedit
gnome-control-center
gnome-disk-utility
gnome-session
gtk-2.0
nautilus
openbox
smplayer
Thunar
totem
transmission
vlc
Xauthority
Reply all
Reply to author
Forward
0 new messages