diff options
author | James McCoy <jamessan@jamessan.com> | 2016-06-20 20:24:13 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-07-08 01:43:37 -0400 |
commit | 26f74fdf61827f5afc6fe4e90b9e9497264cb039 (patch) | |
tree | fa722246ff2dde5886b6ad6cc40e87b39e3d7b1c | |
parent | ea18b4a60f3b89d261c46b030d3d026ddad864bb (diff) | |
download | rneovim-26f74fdf61827f5afc6fe4e90b9e9497264cb039.tar.gz rneovim-26f74fdf61827f5afc6fe4e90b9e9497264cb039.tar.bz2 rneovim-26f74fdf61827f5afc6fe4e90b9e9497264cb039.zip |
vim-patch:7.4.1550
Problem: Cannot load packages early.
Solution: Add the ":packloadall" command.
https://github.com/vim/vim/commit/2d8f56acb32428d0f965d42dd13b27100b46fa15
-rw-r--r-- | src/nvim/ex_cmds.lua | 6 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 12 | ||||
-rw-r--r-- | src/nvim/main.c | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | test/functional/legacy/packadd_spec.lua | 22 |
5 files changed, 39 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index 0e8cf21d69..76191d5a56 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -1855,6 +1855,12 @@ return { func='ex_packadd', }, { + command='packloadall', + flags=bit.bor(BANG, TRLBAR, SBOXOK, CMDWIN), + addr_type=ADDR_LINES, + func='ex_packloadall', + }, + { command='pclose', flags=bit.bor(BANG, TRLBAR), addr_type=ADDR_LINES, diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 3f211d7ab8..17125ec798 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2496,11 +2496,17 @@ theend: xfree(ffname); } +static bool did_source_packages = false; + +// ":packloadall" // Find plugins in the package directories and source them. -void source_packages(void) +void ex_packloadall(exarg_T *eap) { - do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, - add_pack_plugin, p_pp); + if (!did_source_packages || (eap != NULL && eap->forceit)) { + did_source_packages = true; + do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, + add_pack_plugin, p_pp); + } } /// ":packadd[!] {name}" diff --git a/src/nvim/main.c b/src/nvim/main.c index dcfd9b0fdf..787a99802b 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1244,7 +1244,7 @@ static void load_plugins(void) source_runtime((char_u *)"plugin/**/*.vim", TRUE); TIME_MSG("loading plugins"); - source_packages(); + ex_packloadall(NULL); TIME_MSG("loading packages"); } } diff --git a/src/nvim/version.c b/src/nvim/version.c index 9fcc811f7a..97cd65700f 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -145,7 +145,7 @@ static int included_patches[] = { // 1553, // 1552, // 1551, - // 1550, + 1550, // 1549, // 1548, // 1547, diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index e84a8e60d6..5006981f8f 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -73,6 +73,23 @@ describe('packadd', function() packadd! mytest call assert_equal(new_rtp, &rtp) endfunc + + func Test_packloadall() + let plugindir = &packpath . '/pack/mine/start/foo/plugin' + call mkdir(plugindir, 'p') + call writefile(['let g:plugin_foo_number = 1234'], plugindir . '/bar.vim') + packloadall + call assert_equal(1234, g:plugin_foo_number) + + " only works once + call writefile(['let g:plugin_bar_number = 4321'], plugindir . '/bar2.vim') + packloadall + call assert_false(exists('g:plugin_bar_number')) + + " works when ! used + packloadall! + call assert_equal(4321, g:plugin_bar_number) + endfunc ]=]) call('SetUp') end) @@ -91,6 +108,11 @@ describe('packadd', function() expected_empty() end) + it('works with :packloadall', function() + call('Test_packloadall') + expected_empty() + end) + describe('command line completion', function() local Screen = require('test.functional.ui.screen') local screen |