From 622c3454dff35cae7ec93383bbf49f16621dc778 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 21 Aug 2017 12:47:58 -0400 Subject: vim-patch:8.0.0612 Problem: Package directories are added to 'runtimepath' only after loading non-package plugins. Solution: Split off the code to add package directories to 'runtimepath'. (Ingo Karkat, closes vim/vim#1680) https://github.com/vim/vim/commit/ce876aaa9a250a5a0d0e34b3a2625e51cf9bf5bb --- src/nvim/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index a665ad1de2..6e85fbc130 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1291,10 +1291,21 @@ static void set_window_layout(mparm_T *paramp) static void load_plugins(void) { if (p_lpl) { + // First add all package directories to 'runtimepath', so that their + // autoload directories can be found. Only if not done already with a + // :packloadall command. + if (!did_source_packages) { + add_pack_start_dirs(); + } + source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER); // NOLINT TIME_MSG("loading plugins"); - ex_packloadall(NULL); + // Only source "start" packages if not done already with a :packloadall + // command. + if (!did_source_packages) { + load_start_packages(); + } TIME_MSG("loading packages"); source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_AFTER); -- cgit From 41d180abb4693814be5833b0907e111ce46b3791 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 21 Aug 2017 12:54:22 -0400 Subject: vim-patch:8.0.0680 Problem: Plugins in start packages are sourced twice. (mseplowitz) Solution: Use the unmodified runtime path when loading plugins (test by Ingo Karkat, closes vim/vim#1801) https://github.com/vim/vim/commit/07ecfa64a18609a986f21d6132d04ee8934f3200 --- src/nvim/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index 6e85fbc130..f601fd7ea3 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1291,15 +1291,23 @@ static void set_window_layout(mparm_T *paramp) static void load_plugins(void) { if (p_lpl) { + char_u *rtp_copy = NULL; + // First add all package directories to 'runtimepath', so that their // autoload directories can be found. Only if not done already with a // :packloadall command. + // Make a copy of 'runtimepath', so that source_runtime does not use the + // pack directories. if (!did_source_packages) { + rtp_copy = vim_strsave(p_rtp); add_pack_start_dirs(); } - source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER); // NOLINT + source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy, + (char_u *)"plugin/**/*.vim", // NOLINT + DIP_ALL | DIP_NOAFTER); TIME_MSG("loading plugins"); + xfree(rtp_copy); // Only source "start" packages if not done already with a :packloadall // command. -- cgit From e5565891af5858965a65366ecb7f791abc988931 Mon Sep 17 00:00:00 2001 From: Yuto Tokunaga Date: Wed, 23 Aug 2017 07:55:00 +0900 Subject: win: wmain(): locale-independent argv (#7180) fix #7060 --- src/nvim/main.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index f601fd7ea3..af614762ac 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -7,6 +7,11 @@ #include #include +#ifdef WIN32 +# include +# include +#endif + #include #include "nvim/ascii.h" @@ -215,10 +220,28 @@ void early_init(void) #ifdef MAKE_LIB int nvim_main(int argc, char **argv) +#elif defined WIN32 +// don't use codepage encoded arguments. see #7060 +int wmain(int argc, wchar_t **argv_w) #else int main(int argc, char **argv) #endif { +#ifdef WIN32 + char *argv[argc]; + + for (size_t i = 0; i < (size_t)argc; i++) { + // get required buffer size + size_t dest_size = (size_t)WideCharToMultiByte( + CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL); + char *buf = (char *)xmallocz(dest_size); + // convert from utf16 (widechar) utf8 (multibyte) + WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, buf, (int)dest_size, + NULL, NULL); + argv[i] = buf; + } +#endif + argv0 = argv[0]; char_u *fname = NULL; // file name from command line -- cgit From 71df5dde6d99da73eaea1989a309ffe2a5c7689d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 23 Aug 2017 01:17:59 +0200 Subject: win: wmain(): use utf16_to_utf8() #7060 --- src/nvim/main.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index af614762ac..53a1342b2a 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -220,24 +220,18 @@ void early_init(void) #ifdef MAKE_LIB int nvim_main(int argc, char **argv) -#elif defined WIN32 -// don't use codepage encoded arguments. see #7060 -int wmain(int argc, wchar_t **argv_w) +#elif defined(WIN32) +int wmain(int argc, wchar_t **argv_w) // multibyte args on Windows. #7060 #else int main(int argc, char **argv) #endif { #ifdef WIN32 char *argv[argc]; - - for (size_t i = 0; i < (size_t)argc; i++) { - // get required buffer size - size_t dest_size = (size_t)WideCharToMultiByte( - CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL); - char *buf = (char *)xmallocz(dest_size); - // convert from utf16 (widechar) utf8 (multibyte) - WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, buf, (int)dest_size, - NULL, NULL); + for (int i = 0; i < argc; i++) { + char *buf = NULL; + utf16_to_utf8(argv_w[i], &buf); + assert(buf); argv[i] = buf; } #endif -- cgit From 02e5eafa86c729cee238ed6166a560ed9a555fc8 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 23 Aug 2017 01:30:25 +0200 Subject: win: expect utf8-encoded `argv` when built as a library --- src/nvim/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index 53a1342b2a..024c56dd05 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -226,7 +226,7 @@ int wmain(int argc, wchar_t **argv_w) // multibyte args on Windows. #7060 int main(int argc, char **argv) #endif { -#ifdef WIN32 +#if defined(WIN32) && !defined(MAKE_LIB) char *argv[argc]; for (int i = 0; i < argc; i++) { char *buf = NULL; -- cgit