mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
feat(env): remove VIM_VERSION_NODOT macro #34890
Problem: - The VIM_VERSION_NODOT macro maintained support for legacy Vim version-specific runtime directories (e.g., "vim82") which I believe have never been relevant for Neovim Solution: - Remove it - Rename `vim_version_dir()` to `vim_runtime_dir()`
This commit is contained in:
@@ -303,6 +303,8 @@ These existing features changed their behavior.
|
|||||||
• 'spellfile' location defaults to `stdpath("data").."/site/spell/"` instead of
|
• 'spellfile' location defaults to `stdpath("data").."/site/spell/"` instead of
|
||||||
the first writable directory in 'runtimepath'.
|
the first writable directory in 'runtimepath'.
|
||||||
• |vim.version.range()| doesn't exclude `to` if it is equal to `from`.
|
• |vim.version.range()| doesn't exclude `to` if it is equal to `from`.
|
||||||
|
• |$VIM| and |$VIMRUNTIME| no longer check for Vim version-specific runtime
|
||||||
|
directory `vim{number}` (e.g. `vim82`).
|
||||||
• 'scrollback' maximum value increased from 100000 to 1000000
|
• 'scrollback' maximum value increased from 100000 to 1000000
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@@ -670,13 +670,11 @@ the main help file is normally "$VIMRUNTIME/doc/help.txt".
|
|||||||
Nvim will try to get the value for $VIMRUNTIME in this order:
|
Nvim will try to get the value for $VIMRUNTIME in this order:
|
||||||
|
|
||||||
1. Environment variable $VIMRUNTIME, if it is set.
|
1. Environment variable $VIMRUNTIME, if it is set.
|
||||||
2. Directory path "$VIM/vim{version}", if it exists, where {version} is the
|
2. Directory path "$VIM/runtime", if it exists.
|
||||||
Vim version number without '-' or '.'. For example: "$VIM/vim82".
|
3. Value of $VIM environment variable. This is for backwards compatibility
|
||||||
3. Directory path "$VIM/runtime", if it exists.
|
|
||||||
4. Value of $VIM environment variable. This is for backwards compatibility
|
|
||||||
with older Vim versions.
|
with older Vim versions.
|
||||||
5. If "../share/nvim/runtime" exists relative to |v:progpath|, it is used.
|
4. If "../share/nvim/runtime" exists relative to |v:progpath|, it is used.
|
||||||
6. Path derived from the 'helpfile' option (if it doesn't contain '$') with
|
5. Path derived from the 'helpfile' option (if it doesn't contain '$') with
|
||||||
"doc/help.txt" removed from the end.
|
"doc/help.txt" removed from the end.
|
||||||
|
|
||||||
After doing this once, Nvim sets the $VIMRUNTIME environment variable.
|
After doing this once, Nvim sets the $VIMRUNTIME environment variable.
|
||||||
|
@@ -781,20 +781,15 @@ size_t expand_env_esc(const char *restrict srcp, char *restrict dst, int dstlen,
|
|||||||
return (size_t)(dst - dst_start);
|
return (size_t)(dst - dst_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the directory "vimdir/<version>" or "vimdir/runtime" exists.
|
/// Check if the directory "vimdir/runtime" exists.
|
||||||
/// Return NULL if not, return its name in allocated memory otherwise.
|
/// Return NULL if not, return its name in allocated memory otherwise.
|
||||||
/// @param vimdir directory to test
|
/// @param vimdir directory to test
|
||||||
static char *vim_version_dir(const char *vimdir)
|
static char *vim_runtime_dir(const char *vimdir)
|
||||||
{
|
{
|
||||||
if (vimdir == NULL || *vimdir == NUL) {
|
if (vimdir == NULL || *vimdir == NUL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
char *p = concat_fnames(vimdir, VIM_VERSION_NODOT, true);
|
char *p = concat_fnames(vimdir, RUNTIME_DIRNAME, true);
|
||||||
if (os_isdir(p)) {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
xfree(p);
|
|
||||||
p = concat_fnames(vimdir, RUNTIME_DIRNAME, true);
|
|
||||||
if (os_isdir(p)) {
|
if (os_isdir(p)) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@@ -946,7 +941,7 @@ char *vim_getenv(const char *name)
|
|||||||
&& *default_vimruntime_dir == NUL) {
|
&& *default_vimruntime_dir == NUL) {
|
||||||
kos_env_path = os_getenv("VIM"); // kos_env_path was NULL.
|
kos_env_path = os_getenv("VIM"); // kos_env_path was NULL.
|
||||||
if (kos_env_path != NULL) {
|
if (kos_env_path != NULL) {
|
||||||
vim_path = vim_version_dir(kos_env_path);
|
vim_path = vim_runtime_dir(kos_env_path);
|
||||||
if (vim_path == NULL) {
|
if (vim_path == NULL) {
|
||||||
vim_path = kos_env_path;
|
vim_path = kos_env_path;
|
||||||
} else {
|
} else {
|
||||||
@@ -981,10 +976,9 @@ char *vim_getenv(const char *name)
|
|||||||
vim_path_end = remove_tail(vim_path, vim_path_end, "doc");
|
vim_path_end = remove_tail(vim_path, vim_path_end, "doc");
|
||||||
}
|
}
|
||||||
|
|
||||||
// for $VIM, remove "runtime/" or "vim54/", if present
|
// for $VIM, remove "runtime/", if present
|
||||||
if (!vimruntime) {
|
if (!vimruntime) {
|
||||||
vim_path_end = remove_tail(vim_path, vim_path_end, RUNTIME_DIRNAME);
|
vim_path_end = remove_tail(vim_path, vim_path_end, RUNTIME_DIRNAME);
|
||||||
vim_path_end = remove_tail(vim_path, vim_path_end, VIM_VERSION_NODOT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing path separator
|
// remove trailing path separator
|
||||||
@@ -1012,7 +1006,7 @@ char *vim_getenv(const char *name)
|
|||||||
vim_path = xstrdup(default_vimruntime_dir);
|
vim_path = xstrdup(default_vimruntime_dir);
|
||||||
} else if (*default_vim_dir != NUL) {
|
} else if (*default_vim_dir != NUL) {
|
||||||
if (vimruntime
|
if (vimruntime
|
||||||
&& (vim_path = vim_version_dir(default_vim_dir)) == NULL) {
|
&& (vim_path = vim_runtime_dir(default_vim_dir)) == NULL) {
|
||||||
vim_path = xstrdup(default_vim_dir);
|
vim_path = xstrdup(default_vim_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,8 +24,6 @@ extern char *version_cflags;
|
|||||||
#define VIM_VERSION_MINOR_STR STR(VIM_VERSION_MINOR)
|
#define VIM_VERSION_MINOR_STR STR(VIM_VERSION_MINOR)
|
||||||
#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
|
#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
|
||||||
|
|
||||||
// used for the runtime directory name
|
|
||||||
#define VIM_VERSION_NODOT "vim" VIM_VERSION_MAJOR_STR VIM_VERSION_MINOR_STR
|
|
||||||
// swap file compatibility (max. length is 6 chars)
|
// swap file compatibility (max. length is 6 chars)
|
||||||
#define VIM_VERSION_SHORT VIM_VERSION_MAJOR_STR "." VIM_VERSION_MINOR_STR
|
#define VIM_VERSION_SHORT VIM_VERSION_MAJOR_STR "." VIM_VERSION_MINOR_STR
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user