mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1550
Problem: Cannot load packages early.
Solution: Add the ":packloadall" command.
2d8f56acb3
This commit is contained in:
parent
ea18b4a60f
commit
26f74fdf61
@ -1854,6 +1854,12 @@ return {
|
|||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='ex_packadd',
|
func='ex_packadd',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
command='packloadall',
|
||||||
|
flags=bit.bor(BANG, TRLBAR, SBOXOK, CMDWIN),
|
||||||
|
addr_type=ADDR_LINES,
|
||||||
|
func='ex_packloadall',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
command='pclose',
|
command='pclose',
|
||||||
flags=bit.bor(BANG, TRLBAR),
|
flags=bit.bor(BANG, TRLBAR),
|
||||||
|
@ -2496,11 +2496,17 @@ theend:
|
|||||||
xfree(ffname);
|
xfree(ffname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool did_source_packages = false;
|
||||||
|
|
||||||
|
// ":packloadall"
|
||||||
// Find plugins in the package directories and source them.
|
// 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,
|
if (!did_source_packages || (eap != NULL && eap->forceit)) {
|
||||||
add_pack_plugin, p_pp);
|
did_source_packages = true;
|
||||||
|
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
|
||||||
|
add_pack_plugin, p_pp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ":packadd[!] {name}"
|
/// ":packadd[!] {name}"
|
||||||
|
@ -1244,7 +1244,7 @@ static void load_plugins(void)
|
|||||||
source_runtime((char_u *)"plugin/**/*.vim", TRUE);
|
source_runtime((char_u *)"plugin/**/*.vim", TRUE);
|
||||||
TIME_MSG("loading plugins");
|
TIME_MSG("loading plugins");
|
||||||
|
|
||||||
source_packages();
|
ex_packloadall(NULL);
|
||||||
TIME_MSG("loading packages");
|
TIME_MSG("loading packages");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ static int included_patches[] = {
|
|||||||
// 1553,
|
// 1553,
|
||||||
// 1552,
|
// 1552,
|
||||||
// 1551,
|
// 1551,
|
||||||
// 1550,
|
1550,
|
||||||
// 1549,
|
// 1549,
|
||||||
// 1548,
|
// 1548,
|
||||||
// 1547,
|
// 1547,
|
||||||
|
@ -73,6 +73,23 @@ describe('packadd', function()
|
|||||||
packadd! mytest
|
packadd! mytest
|
||||||
call assert_equal(new_rtp, &rtp)
|
call assert_equal(new_rtp, &rtp)
|
||||||
endfunc
|
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')
|
call('SetUp')
|
||||||
end)
|
end)
|
||||||
@ -91,6 +108,11 @@ describe('packadd', function()
|
|||||||
expected_empty()
|
expected_empty()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('works with :packloadall', function()
|
||||||
|
call('Test_packloadall')
|
||||||
|
expected_empty()
|
||||||
|
end)
|
||||||
|
|
||||||
describe('command line completion', function()
|
describe('command line completion', function()
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local screen
|
local screen
|
||||||
|
Loading…
Reference in New Issue
Block a user