Skip to content

Commit 66dc685

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents c6b93c1 + 3321e9d commit 66dc685

22 files changed

Lines changed: 507 additions & 262 deletions

runtime/doc/eval.txt

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 02
1+
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 06
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2339,6 +2339,7 @@ test_null_list() List null value for testing
23392339
test_null_partial() Funcref null value for testing
23402340
test_null_string() String null value for testing
23412341
test_settime({expr}) none set current time for testing
2342+
timer_info([{id}]) List information about timers
23422343
timer_start({time}, {callback} [, {options}])
23432344
Number create a timer
23442345
timer_stop({timer}) none stop a timer
@@ -3392,9 +3393,13 @@ exepath({expr}) *exepath()*
33923393
an empty string is returned.
33933394

33943395
*exists()*
3395-
exists({expr}) The result is a Number, which is |TRUE| if {expr} is
3396-
defined, zero otherwise. The {expr} argument is a string,
3397-
which contains one of these:
3396+
exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
3397+
zero otherwise.
3398+
3399+
For checking for a supported feature use |has()|.
3400+
For checking if a file exists use |filereadable()|.
3401+
3402+
The {expr} argument is a string, which contains one of these:
33983403
&option-name Vim option (only checks if it exists,
33993404
not if it really works)
34003405
+option-name Vim option that works.
@@ -3442,7 +3447,6 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is
34423447
event and pattern.
34433448
##event autocommand for this event is
34443449
supported.
3445-
For checking for a supported feature use |has()|.
34463450

34473451
Examples: >
34483452
exists("&shortname")
@@ -5476,7 +5480,8 @@ matchadd({group}, {pattern}[, {priority}[, {id}[, {dict}]]])
54765480
available from |getmatches()|. All matches can be deleted in
54775481
one operation by |clearmatches()|.
54785482

5479-
matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) *matchaddpos()*
5483+
*matchaddpos()*
5484+
matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]])
54805485
Same as |matchadd()|, but requires a list of positions {pos}
54815486
instead of a pattern. This command is faster than |matchadd()|
54825487
because it does not require to handle regular expressions and
@@ -7536,6 +7541,23 @@ test_settime({expr}) *test_settime()*
75367541
{expr} must evaluate to a number. When the value is zero the
75377542
normal behavior is restored.
75387543

7544+
*timer_info()*
7545+
timer_info([{id}])
7546+
Return a list with information about timers.
7547+
When {id} is given only information about this timer is
7548+
returned. When timer {id} does not exist an empty list is
7549+
returned.
7550+
When {id} is omitted information about all timers is returned.
7551+
7552+
For each timer the information is stored in a Dictionary with
7553+
these items:
7554+
"id" the timer ID
7555+
"time" time the timer was started with
7556+
"remaining" time until the timer fires
7557+
"repeat" number of times the timer will still fire;
7558+
-1 means forever
7559+
"callback" the callback
7560+
75397561
*timer_start()*
75407562
timer_start({time}, {callback} [, {options}])
75417563
Create a timer and return the timer ID.
@@ -7566,7 +7588,7 @@ timer_start({time}, {callback} [, {options}])
75667588
timer_stop({timer}) *timer_stop()*
75677589
Stop a timer. The timer callback will no longer be invoked.
75687590
{timer} is an ID returned by timer_start(), thus it must be a
7569-
Number.
7591+
Number. If {timer} does not exist there is no error.
75707592

75717593
tolower({expr}) *tolower()*
75727594
The result is a copy of the String given, with all uppercase

runtime/doc/starting.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 29
1+
*starting.txt* For Vim version 7.4. Last change: 2016 Aug 06
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -859,20 +859,27 @@ accordingly. Vim proceeds in this order:
859859
searched for the "plugin" sub-directory and all files ending in ".vim"
860860
will be sourced (in alphabetical order per directory), also in
861861
subdirectories.
862+
However, directories in 'runtimepath' ending in "after" are skipped
863+
here and only loaded after packages, see below.
862864
Loading plugins won't be done when:
863865
- The 'loadplugins' option was reset in a vimrc file.
864866
- The |--noplugin| command line argument is used.
865867
- The "-u NONE" command line argument is used |-u|.
866868
- When Vim was compiled without the |+eval| feature.
867869
Note that using "-c 'set noloadplugins'" doesn't work, because the
868870
commands from the command line have not been executed yet. You can
869-
use "--cmd 'set noloadplugins'" |--cmd|.
871+
use "--cmd 'set noloadplugins'" or "--cmd 'set loadplugins'" |--cmd|.
870872

871873
Packages are loaded. These are plugins, as above, but found in the
872874
"start" directory of each entry in 'packpath'. Every plugin directory
873875
found is added in 'runtimepath' and then the plugins are sourced. See
874876
|packages|.
875877

878+
The plugins scripts are loaded, as above, but now only the directories
879+
ending in "after" are used. Note that 'runtimepath' will have changed
880+
if packages have been found, but that should not add a directory
881+
ending in "after".
882+
876883
5. Set 'shellpipe' and 'shellredir'
877884
The 'shellpipe' and 'shellredir' options are set according to the
878885
value of the 'shell' option, unless they have been set before.

src/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ test1 \
20612061
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
20622062
test40 test41 test42 test43 test44 test45 test46 test48 test49 \
20632063
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
2064-
test60 test62 test63 test64 test65 test66 test67 test68 test69 \
2064+
test60 test62 test64 test65 test66 test67 test68 test69 \
20652065
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
20662066
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
20672067
test90 test91 test92 test93 test94 test95 test97 test98 test99 \
@@ -2112,9 +2112,9 @@ test_arglist \
21122112
test_largefile \
21132113
test_lispwords \
21142114
test_man \
2115+
test_match \
21152116
test_matchadd_conceal \
21162117
test_matchadd_conceal_utf8 \
2117-
test_matchstrpos \
21182118
test_menu \
21192119
test_messages \
21202120
test_netbeans \

src/evalfunc.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ static void f_tan(typval_T *argvars, typval_T *rettv);
396396
static void f_tanh(typval_T *argvars, typval_T *rettv);
397397
#endif
398398
#ifdef FEAT_TIMERS
399+
static void f_timer_info(typval_T *argvars, typval_T *rettv);
399400
static void f_timer_start(typval_T *argvars, typval_T *rettv);
400401
static void f_timer_stop(typval_T *argvars, typval_T *rettv);
401402
#endif
@@ -815,6 +816,7 @@ static struct fst
815816
{"test_null_string", 0, 0, f_test_null_string},
816817
{"test_settime", 1, 1, f_test_settime},
817818
#ifdef FEAT_TIMERS
819+
{"timer_info", 0, 1, f_timer_info},
818820
{"timer_start", 2, 3, f_timer_start},
819821
{"timer_stop", 1, 1, f_timer_stop},
820822
#endif
@@ -4254,6 +4256,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
42544256
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
42554257
}
42564258
#endif
4259+
#ifdef FEAT_SIGNS
4260+
if (xpc.xp_context == EXPAND_SIGN)
4261+
{
4262+
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
4263+
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
4264+
}
4265+
#endif
42574266

42584267
pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
42594268
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
@@ -11980,6 +11989,31 @@ free_callback(char_u *callback, partial_T *partial)
1198011989
#endif
1198111990

1198211991
#ifdef FEAT_TIMERS
11992+
/*
11993+
* "timer_info([timer])" function
11994+
*/
11995+
static void
11996+
f_timer_info(typval_T *argvars, typval_T *rettv)
11997+
{
11998+
timer_T *timer = NULL;
11999+
12000+
if (rettv_list_alloc(rettv) != OK)
12001+
return;
12002+
if (argvars[0].v_type != VAR_UNKNOWN)
12003+
{
12004+
if (argvars[0].v_type != VAR_NUMBER)
12005+
EMSG(_(e_number_exp));
12006+
else
12007+
{
12008+
timer = find_timer((int)get_tv_number(&argvars[0]));
12009+
if (timer != NULL)
12010+
add_timer_info(rettv, timer);
12011+
}
12012+
}
12013+
else
12014+
add_timer_info_all(rettv);
12015+
}
12016+
1198312017
/*
1198412018
* "timer_start(time, callback [, options])" function
1198512019
*/

src/ex_cmds2.c

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,10 +1139,8 @@ create_timer(long msec, int repeat)
11391139
timer->tr_id = ++last_timer_id;
11401140
insert_timer(timer);
11411141
if (repeat != 0)
1142-
{
11431142
timer->tr_repeat = repeat - 1;
1144-
timer->tr_interval = msec;
1145-
}
1143+
timer->tr_interval = msec;
11461144

11471145
profile_setlimit(msec, &timer->tr_due);
11481146
return timer;
@@ -1253,6 +1251,68 @@ stop_timer(timer_T *timer)
12531251
free_timer(timer);
12541252
}
12551253

1254+
void
1255+
add_timer_info(typval_T *rettv, timer_T *timer)
1256+
{
1257+
list_T *list = rettv->vval.v_list;
1258+
dict_T *dict = dict_alloc();
1259+
dictitem_T *di;
1260+
long remaining;
1261+
proftime_T now;
1262+
# ifdef WIN3264
1263+
LARGE_INTEGER fr;
1264+
#endif
1265+
1266+
if (dict == NULL)
1267+
return;
1268+
list_append_dict(list, dict);
1269+
1270+
dict_add_nr_str(dict, "id", (long)timer->tr_id, NULL);
1271+
dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL);
1272+
1273+
profile_start(&now);
1274+
# ifdef WIN3264
1275+
QueryPerformanceFrequency(&fr);
1276+
remaining = (long)(((double)(timer->tr_due.QuadPart - now.QuadPart)
1277+
/ (double)fr.QuadPart) * 1000);
1278+
# else
1279+
remaining = (timer->tr_due.tv_sec - now.tv_sec) * 1000
1280+
+ (timer->tr_due.tv_usec - now.tv_usec) / 1000;
1281+
# endif
1282+
dict_add_nr_str(dict, "remaining", (long)remaining, NULL);
1283+
1284+
dict_add_nr_str(dict, "repeat",
1285+
(long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1), NULL);
1286+
1287+
di = dictitem_alloc((char_u *)"callback");
1288+
if (di != NULL)
1289+
{
1290+
if (dict_add(dict, di) == FAIL)
1291+
vim_free(di);
1292+
else if (timer->tr_partial != NULL)
1293+
{
1294+
di->di_tv.v_type = VAR_PARTIAL;
1295+
di->di_tv.vval.v_partial = timer->tr_partial;
1296+
++timer->tr_partial->pt_refcount;
1297+
}
1298+
else
1299+
{
1300+
di->di_tv.v_type = VAR_FUNC;
1301+
di->di_tv.vval.v_string = vim_strsave(timer->tr_callback);
1302+
}
1303+
di->di_tv.v_lock = 0;
1304+
}
1305+
}
1306+
1307+
void
1308+
add_timer_info_all(typval_T *rettv)
1309+
{
1310+
timer_T *timer;
1311+
1312+
for (timer = first_timer; timer != NULL; timer = timer->tr_next)
1313+
add_timer_info(rettv, timer);
1314+
}
1315+
12561316
/*
12571317
* Mark references in partials of timers.
12581318
*/
@@ -3313,15 +3373,30 @@ do_in_path(
33133373
rtp = rtp_copy;
33143374
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one))
33153375
{
3376+
size_t buflen;
3377+
33163378
/* Copy the path from 'runtimepath' to buf[]. */
33173379
copy_option_part(&rtp, buf, MAXPATHL, ",");
3380+
buflen = STRLEN(buf);
3381+
3382+
/* Skip after or non-after directories. */
3383+
if (flags & (DIP_NOAFTER | DIP_AFTER))
3384+
{
3385+
int is_after = buflen >= 5
3386+
&& STRCMP(buf + buflen - 5, "after") == 0;
3387+
3388+
if ((is_after && (flags & DIP_NOAFTER))
3389+
|| (!is_after && (flags & DIP_AFTER)))
3390+
continue;
3391+
}
3392+
33183393
if (name == NULL)
33193394
{
33203395
(*callback)(buf, (void *) &cookie);
33213396
if (!did_one)
33223397
did_one = (cookie == NULL);
33233398
}
3324-
else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL)
3399+
else if (buflen + STRLEN(name) + 2 < MAXPATHL)
33253400
{
33263401
add_pathsep(buf);
33273402
tail = buf + STRLEN(buf);
@@ -3585,6 +3660,7 @@ static int did_source_packages = FALSE;
35853660
/*
35863661
* ":packloadall"
35873662
* Find plugins in the package directories and source them.
3663+
* "eap" is NULL when invoked during startup.
35883664
*/
35893665
void
35903666
ex_packloadall(exarg_T *eap)

src/main.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,11 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
455455
#endif
456456

457457
#ifndef NO_VIM_MAIN
458+
/* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
459+
* Allows for setting 'loadplugins' there. */
460+
if (params.use_vimrc != NULL && STRCMP(params.use_vimrc, "NONE") == 0)
461+
p_lpl = FALSE;
462+
458463
/* Execute --cmd arguments. */
459464
exe_pre_commands(&params);
460465

@@ -469,14 +474,22 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
469474
if (p_lpl)
470475
{
471476
# ifdef VMS /* Somehow VMS doesn't handle the "**". */
472-
source_runtime((char_u *)"plugin/*.vim", DIP_ALL);
477+
source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_NOAFTER);
473478
# else
474-
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL);
479+
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER);
475480
# endif
476481
TIME_MSG("loading plugins");
477482

478483
ex_packloadall(NULL);
479484
TIME_MSG("loading packages");
485+
486+
# ifdef VMS /* Somehow VMS doesn't handle the "**". */
487+
source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_AFTER);
488+
# else
489+
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_AFTER);
490+
# endif
491+
TIME_MSG("loading after plugins");
492+
480493
}
481494
#endif
482495

@@ -3023,8 +3036,6 @@ source_startup_scripts(mparm_T *parmp)
30233036
if (use_gvimrc == NULL) /* don't load gvimrc either */
30243037
use_gvimrc = parmp->use_vimrc;
30253038
#endif
3026-
if (parmp->use_vimrc[2] == 'N')
3027-
p_lpl = FALSE; /* don't load plugins either */
30283039
}
30293040
else
30303041
{

src/proto/ex_cmds2.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ timer_T *create_timer(long msec, int repeat);
2222
long check_due_timer(void);
2323
timer_T *find_timer(int id);
2424
void stop_timer(timer_T *timer);
25+
void add_timer_info(typval_T *rettv, timer_T *timer);
26+
void add_timer_info_all(typval_T *rettv);
2527
int set_ref_in_timer(int copyID);
2628
void timer_free_all(void);
2729
void profile_divide(proftime_T *tm, int count, proftime_T *tm2);

src/testdir/Make_all.mak

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ SCRIPTS_ALL = \
5151
test57.out \
5252
test60.out \
5353
test62.out \
54-
test63.out \
5554
test64.out \
5655
test65.out \
5756
test66.out \

src/testdir/Make_dos.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,6 @@ bench_re_freeze.out: bench_re_freeze.vim
114114
newtests: $(NEW_TESTS)
115115

116116
.vim.res:
117+
@echo "$(VIMPROG)" > vimcmd
117118
$(VIMPROG) -u NONE $(NO_PLUGIN) -S runtest.vim $*.vim
119+
@del vimcmd

0 commit comments

Comments
 (0)