-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support XDG directory specification #78
Comments
👍 |
👍 |
2 similar comments
👍 |
👍 |
👍 long overdue |
Definitely needed |
|
I think we should take the approach suggested in #460 and delegate it to an external tool. In any case we can revisit this later |
@tarruda I think you might be misunderstanding what this is about: the XDG Base Directory Specification is meant to stop applications from littering the user’s home dir with configuration files and directories by offering a common, configurable set of base directories for these. In the case of Vim, we are talking about @ZyX-I good call, but swap files should not be put in
|
Completely agree with @kopischke Using a wrapper around the vim executable just so it can read the configuration files from the correct paths does not sound like a sensible option. |
Please support this. It is what compliant Unix citizens are adopting. Neovim is attempting to be a modernization of vim, so I think this qualifies. Thanks for all of the other awesome y'all are bringing! Looking forward to the first release. |
Vim itself will be adding support for this pretty soon, so we'll probably just merge that. |
@justinmk I do not like this idea. Vim support will be optional, falling back to old behaviour because Vim cannot drop backwards compatibility. We can make XDG directories the only default variant since we do not have to be compatible with Vim configuration locations. I do not see any sense in having two default locations for user configuration. |
@ZyX-I you don't want to support |
That's what I read as well. On the face of it, I'm not really in favour of removing support for |
Why should I want it?
Why? If one wants to have it there there are shell aliases, variables like VIMINIT (perhaps should be renamed to NVIMINIT), MYVIMRC (did we drop support for it? MYNVIMRC and MYVIMRC seem not to work), system-wide configuration (which is to be placed in If we do support Vim directories for some reasons this is a separate issue, but currently this is not the case. |
By the way, Vim is the only software I know which supports more then one configuration location. But this support is based on historical reasons and POSIX compliance. This is not the case here:
Based on this facts I think it is required that you will be explaining why if XDG specification is supported |
Thus I think we should tie XDG support and dropping |
Only reason is because I like .nvimrc, and XDG is irrelevant to Windows and OS X, and if we merge the Vim support for XDG then we get everything for "free" (except the maintenance cost). But you're right about symlinks, and it's better to have one recommended path instead of two.
Ok. I'm not sure about renaming those, nor VIMRUNTIME. Need to think about that, because that could affect legacy plugins. |
While XDG is irrelevant for windows using |
Update2:
|
Update 8: Updated |
Change symlink targets to point to the new location of Neovim's config files. I think the change was fairly recent, as per [this Reddit thread](https://www.reddit.com/r/neovim/comments/3qgsza/psa_if_neovim_stopped_loading_your_nvimrc_after/), which points to a [issue neovim#78](neovim/neovim#78).
Change symlink targets to point to the new location of Neovim's config files. I think the change was fairly recent, as per [this Reddit thread](https://www.reddit.com/r/neovim/comments/3qgsza/psa_if_neovim_stopped_loading_your_nvimrc_after/), which points to [issue neovim#78](neovim/neovim#78).
From #26, but I am talking not only about configuration files.
populate runtimepath from
XDG_CONFIG_DIRS
,XDG_DATA_DIRS
,XDG_DATA_HOME
andXDG_CONFIG_HOME
(and$VIMRUNTIME
as well):$XDG_CONFIG_HOME/nvim
$xdg_config_dir/nvim (for each directory in $XDG_CONFIG_DIRS)
$XDG_DATA_HOME/nvim
$xdg_data_dir/nvim/site (for each directory in $XDG_DATA_DIRS)
$VIMRUNTIME (looks something like /usr/share/nvim/runtime)
$xdg_data_dir/nvim/site/after (for each directory in $XDG_DATA_DIRS, reverse order)
$XDG_DATA_HOME/nvim
$xdg_config_dir/nvim/after (for each directory in $XDG_CONFIG_DIRS, reverse order)
$XDG_CONFIG_HOME/nvim/after
init.vim
should be taken from the first directory in$XDG_CONFIG_HOME:$XDG_CONFIG_DIRS
where it was found (e.g. first from~/.config/nvim/init.vim
, then from/etc/xdg/nvim/init.vim
).&directory
option (it holds swap files there) to$XDG_DATA_HOME/nvim/swap//
.&backupdir
to.,$XDG_DATA_HOME/nvim/backup
.&undodir
to$XDG_DATA_HOME/nvim/undo//
.$XDG_DATA_HOME/nvim/shada/main.shada
.&viewdir
to$XDG_DATA_HOME/nvim/view
.OS defaults:
%APPDATA%
, XDG_CACHE_HOME and XDG_RUNTIME_DIR to%TEMP%
(just in case) and XDG_CONFIG_DIRS to empty (as VIMRUNTIME is handled separately).Some other notes:
src/nvim/os/env.c
, alongside with restoredinit_homedir
(which currently lives inmisc1.c
and lacks code for Windows).Note some renamings:
vim74
to7.4
,vimfiles
tosite-contrib
,.vimrc
toinit.vim
. Reasoning behind this: to avoid duplicating data. We already know this directory contains files for neovim since it is named/usr/share/nvim
, why should this information be repeated in the subdirectory? Also it is hard to tell from the directory name what is the difference invim74
andvimfiles
contents, but it is easy for7.4
andsite-contrib
(names are taken from/usr/share/zsh
). Extension designates file type, so no need to remove it, it is for separate purpose.Update: Renamed
rc.vim
tostartup.vim
. Reasoning: this way config file name resembles its purpose. See also #235.Update 2:
neovim
tonvim
as it is new convention.&directory
,&backupdir
and&undodir
defaults to$XDG_DATA_HOME
.&undodir
use trailing//
as well.~/tmp
/$TEMP
/etc defaults from&backupdir
(backups in%TEMP%
?!).&undodir
default. If&backupdir
was supporting trailing//
I would happily remove current directory from there as well: nobody likes spamming working directory with files that are needed only by vim and hardly ever by user.Update 3: All options sharing the same
$XDG_DATA_HOME/nvim
directory were supplied with distinct subpaths.Update 4: Added OS defaults and notes.
Update 5: Renamed
startup.vim
toinit.vim
.Update 6: Added default for ShaDa.
Update 7: Added default for viewdir.
Update 8: Updated
init.vim
search path, as discussed in some of the PRs.The text was updated successfully, but these errors were encountered: