-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
XDG base directory specification support #3470
Conversation
Most of documentation changes is replacing |
Also many removes regarding windows (as I have no idea what should be written there). |
3795136 hanged on unknown test. If 3796471 also hangs I am considering #3427 a blocker (instead of using temporary commit that sets gtest output). BTW, I do not think ZyX-I@dcc02b2 should be a part of this PR, but I do not know whether this should be part of a separate PR, or of something existing windows-related. |
ZyX-I@dcc02b2 is ok for this PR. |
This one also hangs. Hang does not happen locally, thus I am waiting for resolution with #3427. |
9b20f12
to
892c8a9
Compare
By the way, not that this PR originally has |
#ifdef WIN32 | ||
// Windows | ||
#elif APPLE | ||
// Apple (this includes iOS, which we might need to handle differently) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we decided to use the same XDG paths as in other *nixes for OSX (see #3198 (comment) and following)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 👍 Treat OSX as unix. Haters gonna hate.
👍 One of the major advantages of adopting XDG is that we have standard directories to persist swap/undo/backup. We should default to using those and consider enabling swap & persistent undo by default. |
Also it would be good to merge #1909 before this: to place socket in $XDG_RUNTIME_DIR I in any case need a single entry point. |
version_msg(_(" 3rd user vimrc file: \"")); | ||
version_msg(USR_VIMRC_FILE3); | ||
version_msg("\"\n"); | ||
#endif // ifdef USR_VIMRC_FILE3 | ||
#ifdef USR_EXRC_FILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think it makes sense to support USR_EXRC_FILE
or USR_EXRC_FILE2
if we are removing vimrc already.
I have a reason to want |
static const char *const xdg_defaults[] = { | ||
// Windows, Apple stuff are just shims right now | ||
#ifdef WIN32 | ||
// Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we leave this empty for now, what would it mean for people who are building/using nvim in Windows already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
17.10.2015, 21:41, "Felipe Morales" [email protected]:
In src/nvim/os/stdpaths.c:
+static const char *xdg_env_vars[] = { > + [kXDGConfigHome] = "XDG_CONFIG_HOME", > + [kXDGDataHome] = "XDG_DATA_HOME", > + [kXDGCacheHome] = "XDG_CACHE_HOME", > + [kXDGRuntimeDir] = "XDG_RUNTIME_DIR", > + [kXDGConfigDirs] = "XDG_CONFIG_DIRS", > + [kXDGDataDirs] = "XDG_DATA_DIRS", > +}; > + > +/// Defaults for XDGVarType values > +/// > +/// Used in case environment variables contain nothing. Need to be expanded. > +static const char *const xdg_defaults[] = { > + // Windows, Apple stuff are just shims right now > +#ifdef WIN32 > + // Windows
If we leave this empty for now, what would it mean for people who are building/using nvim in Windows already?
That this will fail with syntax error. #endif is wrongly placed.
If it is correctly placed it should SEGV.
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can stub it out with the examples from https://github.com/ActiveState/appdirs/blob/master/appdirs.py .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justinmk Even assuming that C:\\Users\\user\\
from examples is ~\\
(I can’t reliably use $USER
even on *nix) I have no idea what is AppAuthor
. Also what exactly is AppName
: nvim/Neovim/neovim?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZyX-I AppAuthor
in this case should be Neovim
, and the same for AppName
. Supposedly, you could use the %AppData%
environment variable, see http://blogs.msdn.com/b/patricka/archive/2010/03/18/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions.aspx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZyX-I @fmoralesc stub is here: #3470 (comment)
@@ -994,7 +994,7 @@ expect. | |||
Environment variables can be used in a pattern: > | |||
:autocmd BufRead $VIMRUNTIME/doc/*.txt set expandtab | |||
And ~ can be used for the home directory (if $HOME is defined): > | |||
:autocmd BufWritePost ~/.vimrc so ~/.vimrc | |||
:autocmd BufWritePost ~/.config/nvim/init.vim so <afile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding all these references to ~/.config/...
: shouldn't these instead say $XDG_CONFIG_HOME/...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
17.10.2015, 22:01, "Michael Reed" [email protected]:
In runtime/doc/autocmd.txt:
@@ -994,7 +994,7 @@ expect. > Environment variables can be used in a pattern: > > :autocmd BufRead $VIMRUNTIME/doc/*.txt set expandtab > And ~ can be used for the home directory (if $HOME is defined): > > - :autocmd BufWritePost ~/.vimrc so ~/.vimrc > + :autocmd BufWritePost ~/.config/nvim/init.vim so
Regarding all these references to ~/.config/...: shouldn't these instead say $XDG_CONFIG_HOME/...?
Not all of them: $XDG_CONFIG_HOME is not guaranteed to be defined since PR with approach which adds support for XDG_* vars to vim_getenv was rejected.
Most of other stay as-is because I am not fond of explaining WTF is $XDG_CONFIG_HOME and what is its default. I guess we need another section somewhere in documentation (options.txt?) with explanations.
—
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need another section somewhere in documentation (options.txt?) with explanations.
I think that would be a good idea. It's not too complicated, so I think it should be doable in a paragraph or two, at least as a high level overview.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's necessary to be so specific. It is understood that ~/.config
means "what ~/.vim used to mean". And for new users, also, it is easier to understand ~/.config
than an env var from the linux desktop standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, probably. Let's not complicate it further.
@@ -224,7 +224,7 @@ D. If your filetype can only be detected by inspecting the contents of the | |||
|
|||
1. Create your user runtime directory. You would normally use the first | |||
item of the 'runtimepath' option. Example for Unix: > | |||
:!mkdir ~/.vim | |||
:!mkdir ~/.config/nvim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir -p
?
XDG defaults for Windows (reference): + [kXDGConfigHome] = "~\\$CSIDL_LOCAL_APPDATA\\nvim",
+ [kXDGDataHome] = "~\\$CSIDL_LOCAL_APPDATA\\nvim", //same as kXDGConfigHome
+ [kXDGCacheHome] = "~\\$CSIDL_LOCAL_APPDATA\\nvim\\cache",
+ [kXDGRuntimeDir] = "", //I don't know what this is for
+ [kXDGConfigDirs] = "$CSIDL_COMMON_APPDATA\\nvim\\nvim",
+ [kXDGDataDirs] = "$CSIDL_COMMON_APPDATA\\nvim\\nvim", //same as kXDGConfigDirs Note that this does not switch on "roaming" but that is out of scope for now. This should be good enough. |
@justinmk Try |
Great, will update my nvim version with this branch. Thanks to all involved in this. BTW could #3498 be caused by this? |
hey folks, anyone know where the default location for the
|
@wbinnssmith In that case, you should place the autoload directory in |
@wbinnssmith Location of autoload directory did not change at all. The only thing which did change is the default value of &runtimepath. You may create |
@wbinnssmith If you are not using some plugin manager it is now expected that you put Note: putting it into $XDG_CONFIG_HOME/nvim/autoload (which is ~/.config/nvim/autoload by default) will also work, but this is going against XDG spec: |
@fmoralesc There is no |
This is exactly what I expected it would be. Thanks 😄 re:
I'm actually trying to use a plugin manager in this case, which would in this case be the only file in |
@ZyX-I Sorry, you are right about It's worth noting that |
@fmoralesc You are right, I forgot about Additionally users that install Neovim in $HOME may use the same layout: @wbinnssmith Note that I forgot about |
@ZyX-I yeah, I resolved my issue — it was unrelated to the I do think that |
@wbinnssmith No. I have said why |
Previous instructions are outdated as of neovim/neovim#3470.
There was an upstream change in how the config file locations are handled. So now I must symlink ~/.config/nvim/ -> ~/.dotfiles/nvim/ See: neovim/neovim#3470
This is the replacement for #3198, that fully implements #78, including documentation update, as requested in #3198 (comment).
I have not touched pi_.txt, os_.txt, vi_diff.txt, todo.txt, various.txt files.
Note: since it was not discussed, I assumed that
~/.gvimrc
is replaced with$XDG_CONFIG_HOME/nvim/ginit.vim
. Unless it is going away though.