So far this only handles the (.)vimrc file.
It currently takes care of the fallbacks on Linux. I haven't modified the VMS part because I don't understand that yet. And I couldn't find a windows version of vimrc.
Is this an okay change to start with? What recommendations do y'all have?
This will eventually fix #2034
https://github.com/vim/vim/pull/8188
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
$HOME/.vim
and $HOME/.vimrc
are not legacy and shouldn't be treated that way. Having config files in $HOME is the de-facto standard on UNIX-like systems. If anything, I would prefer to see the files tried in the other direction:
De-facto standard first:
$HOME/.vimrc
$HOME/.vim/vimrc
XDG-compliant paths second, with XDG fallback:
$XDG_CONFIG_HOME/.vimrc
$HOME/.config/.vimrc
$XDG_CONFIG_HOME/.vim/vimrc
$HOME/.config/vim/vimrc
Allow me to remind everyone that the content of $HOME/.vim/
(and various other files outside of it) is not 100% "config".
Snippets, dictionaries, spell files are not "config": they are data, which, according to the specification, should be stored under $XDG_DATA_HOME/vim/
.
.netrwhist
, .viminfo
, views, swap files, history, etc. are "state", as defined by the spec, and as such should be stored under $XDG_STATE_HOME/vim/
:
- actions history (logs, history, recently used files, …)
- current state of the application that can be reused on a restart (view, layout, open files, undo history, …)
Cache files generated by plugins (CtrlP comes to mind, maybe there are others) fall under "cache" and should be stored under $XDG_CACHE_HOME/vim/
.
In my opinion…
$XDG_CONFIG_HOME/vim/
is a bad interpretation/understanding of the spec that betrays both its spirit and its letter.Thank you for your inputs! The plan is not to shove everything into $XDG_CONFIG_HOME. This is just the first step toward adhering to the freedesktop spec.
Keep in mind, this is my first time writing C code. I come from a Python background.
@chrisbra I'd like feedback from you too!
I think it's not good to make hidden files under .config
directory, which is already hidden. As Bram says, just adding $XDG_CONFIG_HOME/vim
(and its default value) to the candidates for the personal initialization directories should be enough.
For Windows, I think $APPDATA
instead of $XDG_CONFIG_HOME
is appropriate. It is typically C:\Users\USERNAME\AppData\Roaming
.
$LOCALAPPDATA
can be used for unportable files like viminfo. It is typically C:\Users\USERNAME\AppData\Local
.
cf. KNOWNFOLDERID, CSIDL
You shouldn't use Bool
. We use int in the Vim code base for that and the values TRUE
and FALSE
. For the printing status messages, you can use smsg()
. it supports printf() % tokens
.
Perhaps, write some documentation first, before going to write the patch. So we can all agree on the default or fallback-values and you do not have to change the implementation again and again.
I am not sure about windows, I generally tend to find C:\Users\USERNAME\AppData
mysterious, but as a fallback after $HOME/_vimfiles
I suppose this should be okay.
For Unix, I think the most important things have already been mentioned. In my opinion, having different directories for different purposes ($XDG_CACHE_HOME
, $XDG_CONFIG_HOME
, $XDG_STATE_HOME/vim
), is asking for trouble and will make the configuration for users more complex (and harder to debug), but that is just my opinion.
One thing to keep in mind, undo files and swap files may become very long (since the path name can be encoded in the name), using something like /home/user/config/vim/undo
may cause the complete path name to become too long (I think this has happened before for Neovim with encrypted user-homes (encfs, ecryptfs) where generally only a path limit of 200 characters (or even less, see e.g. https://unix.stackexchange.com/a/32834/303213) is possible. You don't have to solve this now, just something to be aware of (or to mention the limitation in the documentation).
Thanks for your inputs!
I'll work on pseudocode first.
Closing because my C skills aren't as good as I'd like them to be, and I've already moved on to neovim
.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #8188.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.