aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds2.c33
-rw-r--r--src/nvim/version.c2
-rw-r--r--src/nvim/vim.h1
3 files changed, 30 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 8d298ee0a3..755cca3884 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2263,10 +2263,29 @@ void ex_compiler(exarg_T *eap)
}
}
-/// ":runtime {name}"
+/// ":runtime [what] {name}"
void ex_runtime(exarg_T *eap)
{
- source_runtime(eap->arg, eap->forceit ? DIP_ALL : 0);
+ char_u *arg = eap->arg;
+ char_u *p = skiptowhite(arg);
+ ptrdiff_t len = p - arg;
+ int flags = eap->forceit ? DIP_ALL : 0;
+
+ if (STRNCMP(arg, "START", len) == 0) {
+ flags += DIP_START + DIP_NORTP;
+ arg = skipwhite(arg + len);
+ } else if (STRNCMP(arg, "OPT", len) == 0) {
+ flags += DIP_OPT + DIP_NORTP;
+ arg = skipwhite(arg + len);
+ } else if (STRNCMP(arg, "PACK", len) == 0) {
+ flags += DIP_START + DIP_OPT + DIP_NORTP;
+ arg = skipwhite(arg + len);
+ } else if (STRNCMP(arg, "ALL", len) == 0) {
+ flags += DIP_START + DIP_OPT;
+ arg = skipwhite(arg + len);
+ }
+
+ source_runtime(arg, flags);
}
@@ -2388,9 +2407,13 @@ int do_in_path(char_u *path, char_u *name, int flags,
int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback,
void *cookie)
{
- int done = do_in_path(p_rtp, name, flags, callback, cookie);
+ int done = FAIL;
+
+ if ((flags & DIP_NORTP) == 0) {
+ done = do_in_path(p_rtp, name, flags, callback, cookie);
+ }
- if (done == FAIL && (flags & DIP_START)) {
+ if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START)) {
char *start_dir = "pack/*/start/*/%s";
size_t len = STRLEN(start_dir) + STRLEN(name);
char_u *s = xmallocz(len);
@@ -2401,7 +2424,7 @@ int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback,
xfree(s);
}
- if (done == FAIL && (flags & DIP_OPT)) {
+ if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_OPT)) {
char *opt_dir = "pack/*/opt/*/%s";
size_t len = STRLEN(opt_dir) + STRLEN(name);
char_u *s = xmallocz(len);
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 9b4221863c..2fdb443ca6 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -142,7 +142,7 @@ static int included_patches[] = {
// 1556 NA
// 1555 NA
// 1554,
- // 1553,
+ 1553,
1552,
1551,
1550,
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 47c5a0465a..09e9e850a7 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -314,5 +314,6 @@ enum {
#define DIP_ERR 0x04 // give an error message when none found
#define DIP_START 0x08 // also use "start" directory in 'packpath'
#define DIP_OPT 0x10 // also use "opt" directory in 'packpath'
+#define DIP_NORTP 0x20 // do not use 'runtimepath'
#endif /* NVIM_VIM_H */