Skip to content

Commit 5e73ac7

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8a4e024 + ad9c2a0 commit 5e73ac7

14 files changed

Lines changed: 178 additions & 84 deletions

File tree

runtime/doc/autocmd.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ effects. Be careful not to destroy your text.
5252
==============================================================================
5353
2. Defining autocommands *autocmd-define*
5454

55-
Note: The ":autocmd" command cannot be followed by another command, since any
56-
'|' is considered part of the command.
57-
5855
*:au* *:autocmd*
5956
:au[tocmd] [group] {event} {pat} [nested] {cmd}
6057
Add {cmd} to the list of commands that Vim will
@@ -67,6 +64,12 @@ Note: The ":autocmd" command cannot be followed by another command, since any
6764
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
6865
See |autocmd-buflocal|.
6966

67+
Note: The ":autocmd" command can only be followed by another command when the
68+
'|' appears before {cmd}. This works: >
69+
:augroup mine | au! BufRead | augroup END
70+
But this sees "augroup" as part of the defined command: >
71+
:augroup mine | au BufRead * set tw=70 | augroup END
72+
7073
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
7174
arguments are not expanded when the autocommand is defined. These will be
7275
expanded when the Event is recognized, and the {cmd} is executed. The only

runtime/doc/options.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,11 +2636,17 @@ A jump table for the options with a short description can be found at |Q_op|.
26362636
Change the way text is displayed. This is comma separated list of
26372637
flags:
26382638
lastline When included, as much as possible of the last line
2639-
in a window will be displayed. When not included, a
2640-
last line that doesn't fit is replaced with "@" lines.
2639+
in a window will be displayed. "@@@" is put in the
2640+
last columns of the last screen line to indicate the
2641+
rest of the line is not displayed.
2642+
truncate Like "lastline", but "@@@" is displayed in the first
2643+
column of the last screen line. Overrules "lastline".
26412644
uhex Show unprintable characters hexadecimal as <xx>
26422645
instead of using ^C and ~C.
26432646

2647+
When neither "lastline" or "truncate" is included, a last line that
2648+
doesn't fit is replaced with "@" lines.
2649+
26442650
*'eadirection'* *'ead'*
26452651
'eadirection' 'ead' string (default "both")
26462652
global

src/auto/configure

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ infodir
759759
docdir
760760
oldincludedir
761761
includedir
762+
runstatedir
762763
localstatedir
763764
sharedstatedir
764765
sysconfdir
@@ -894,6 +895,7 @@ datadir='${datarootdir}'
894895
sysconfdir='${prefix}/etc'
895896
sharedstatedir='${prefix}/com'
896897
localstatedir='${prefix}/var'
898+
runstatedir='${localstatedir}/run'
897899
includedir='${prefix}/include'
898900
oldincludedir='/usr/include'
899901
docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1146,6 +1148,15 @@ do
11461148
| -silent | --silent | --silen | --sile | --sil)
11471149
silent=yes ;;
11481150

1151+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1152+
| --runstate | --runstat | --runsta | --runst | --runs \
1153+
| --run | --ru | --r)
1154+
ac_prev=runstatedir ;;
1155+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1156+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1157+
| --run=* | --ru=* | --r=*)
1158+
runstatedir=$ac_optarg ;;
1159+
11491160
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11501161
ac_prev=sbindir ;;
11511162
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1283,7 +1294,7 @@ fi
12831294
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12841295
datadir sysconfdir sharedstatedir localstatedir includedir \
12851296
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1286-
libdir localedir mandir
1297+
libdir localedir mandir runstatedir
12871298
do
12881299
eval ac_val=\$$ac_var
12891300
# Remove trailing slashes.
@@ -1436,6 +1447,7 @@ Fine tuning of the installation directories:
14361447
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14371448
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14381449
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1450+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14391451
--libdir=DIR object code libraries [EPREFIX/lib]
14401452
--includedir=DIR C header files [PREFIX/include]
14411453
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1520,7 +1532,7 @@ Optional Packages:
15201532
--with-view-name=NAME what to call the View executable
15211533
--with-global-runtime=DIR global runtime directory in 'runtimepath'
15221534
--with-modified-by=NAME name of who modified a release version
1523-
--with-features=TYPE tiny, small, normal, big or huge (default: normal)
1535+
--with-features=TYPE tiny, small, normal, big or huge (default: huge)
15241536
--with-compiledby=NAME name to show in :version message
15251537
--with-lua-prefix=PFX Prefix where Lua is installed.
15261538
--with-luajit Link with LuaJIT instead of Lua.

src/configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ fi
456456
dnl Check user requested features.
457457

458458
AC_MSG_CHECKING(--with-features argument)
459-
AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
459+
AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: huge)],
460460
features="$withval"; AC_MSG_RESULT($features),
461461
features="huge"; AC_MSG_RESULT(Defaulting to huge))
462462

src/ex_cmds.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,6 +4008,7 @@ do_ecmd(
40084008
}
40094009
vim_free(new_name);
40104010
au_new_curbuf.br_buf = NULL;
4011+
au_new_curbuf.br_buf_free_count = 0;
40114012
#endif
40124013
}
40134014

@@ -4389,6 +4390,7 @@ delbuf_msg(char_u *name)
43894390
name == NULL ? (char_u *)"" : name);
43904391
vim_free(name);
43914392
au_new_curbuf.br_buf = NULL;
4393+
au_new_curbuf.br_buf_free_count = 0;
43924394
}
43934395
#endif
43944396

src/fileio.c

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8138,8 +8138,8 @@ event_name2nr(char_u *start, char_u **end)
81388138
int i;
81398139
int len;
81408140

8141-
/* the event name ends with end of line, a blank or a comma */
8142-
for (p = start; *p && !vim_iswhite(*p) && *p != ','; ++p)
8141+
/* the event name ends with end of line, '|', a blank or a comma */
8142+
for (p = start; *p && !vim_iswhite(*p) && *p != ',' && *p != '|'; ++p)
81438143
;
81448144
for (i = 0; event_names[i].name != NULL; ++i)
81458145
{
@@ -8191,7 +8191,7 @@ find_end_event(
81918191
}
81928192
else
81938193
{
8194-
for (pat = arg; *pat && !vim_iswhite(*pat); pat = p)
8194+
for (pat = arg; *pat && *pat != '|' && !vim_iswhite(*pat); pat = p)
81958195
{
81968196
if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS)
81978197
{
@@ -8324,8 +8324,9 @@ au_event_restore(char_u *old_ei)
83248324
* Mostly a {group} argument can optionally appear before <event>.
83258325
*/
83268326
void
8327-
do_autocmd(char_u *arg, int forceit)
8327+
do_autocmd(char_u *arg_in, int forceit)
83288328
{
8329+
char_u *arg = arg_in;
83298330
char_u *pat;
83308331
char_u *envpat = NULL;
83318332
char_u *cmd;
@@ -8334,12 +8335,20 @@ do_autocmd(char_u *arg, int forceit)
83348335
int nested = FALSE;
83358336
int group;
83368337

8337-
/*
8338-
* Check for a legal group name. If not, use AUGROUP_ALL.
8339-
*/
8340-
group = au_get_grouparg(&arg);
8341-
if (arg == NULL) /* out of memory */
8342-
return;
8338+
if (*arg == '|')
8339+
{
8340+
arg = (char_u *)"";
8341+
group = AUGROUP_ALL; /* no argument, use all groups */
8342+
}
8343+
else
8344+
{
8345+
/*
8346+
* Check for a legal group name. If not, use AUGROUP_ALL.
8347+
*/
8348+
group = au_get_grouparg(&arg);
8349+
if (arg == NULL) /* out of memory */
8350+
return;
8351+
}
83438352

83448353
/*
83458354
* Scan over the events.
@@ -8349,53 +8358,61 @@ do_autocmd(char_u *arg, int forceit)
83498358
if (pat == NULL)
83508359
return;
83518360

8352-
/*
8353-
* Scan over the pattern. Put a NUL at the end.
8354-
*/
83558361
pat = skipwhite(pat);
8356-
cmd = pat;
8357-
while (*cmd && (!vim_iswhite(*cmd) || cmd[-1] == '\\'))
8358-
cmd++;
8359-
if (*cmd)
8360-
*cmd++ = NUL;
8361-
8362-
/* Expand environment variables in the pattern. Set 'shellslash', we want
8363-
* forward slashes here. */
8364-
if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL)
8362+
if (*pat == '|')
83658363
{
8364+
pat = (char_u *)"";
8365+
cmd = (char_u *)"";
8366+
}
8367+
else
8368+
{
8369+
/*
8370+
* Scan over the pattern. Put a NUL at the end.
8371+
*/
8372+
cmd = pat;
8373+
while (*cmd && (!vim_iswhite(*cmd) || cmd[-1] == '\\'))
8374+
cmd++;
8375+
if (*cmd)
8376+
*cmd++ = NUL;
8377+
8378+
/* Expand environment variables in the pattern. Set 'shellslash', we want
8379+
* forward slashes here. */
8380+
if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL)
8381+
{
83668382
#ifdef BACKSLASH_IN_FILENAME
8367-
int p_ssl_save = p_ssl;
8383+
int p_ssl_save = p_ssl;
83688384

8369-
p_ssl = TRUE;
8385+
p_ssl = TRUE;
83708386
#endif
8371-
envpat = expand_env_save(pat);
8387+
envpat = expand_env_save(pat);
83728388
#ifdef BACKSLASH_IN_FILENAME
8373-
p_ssl = p_ssl_save;
8389+
p_ssl = p_ssl_save;
83748390
#endif
8375-
if (envpat != NULL)
8376-
pat = envpat;
8377-
}
8391+
if (envpat != NULL)
8392+
pat = envpat;
8393+
}
83788394

8379-
/*
8380-
* Check for "nested" flag.
8381-
*/
8382-
cmd = skipwhite(cmd);
8383-
if (*cmd != NUL && STRNCMP(cmd, "nested", 6) == 0 && vim_iswhite(cmd[6]))
8384-
{
8385-
nested = TRUE;
8386-
cmd = skipwhite(cmd + 6);
8387-
}
8395+
/*
8396+
* Check for "nested" flag.
8397+
*/
8398+
cmd = skipwhite(cmd);
8399+
if (*cmd != NUL && STRNCMP(cmd, "nested", 6) == 0 && vim_iswhite(cmd[6]))
8400+
{
8401+
nested = TRUE;
8402+
cmd = skipwhite(cmd + 6);
8403+
}
83888404

8389-
/*
8390-
* Find the start of the commands.
8391-
* Expand <sfile> in it.
8392-
*/
8393-
if (*cmd != NUL)
8394-
{
8395-
cmd = expand_sfile(cmd);
8396-
if (cmd == NULL) /* some error */
8397-
return;
8398-
need_free = TRUE;
8405+
/*
8406+
* Find the start of the commands.
8407+
* Expand <sfile> in it.
8408+
*/
8409+
if (*cmd != NUL)
8410+
{
8411+
cmd = expand_sfile(cmd);
8412+
if (cmd == NULL) /* some error */
8413+
return;
8414+
need_free = TRUE;
8415+
}
83998416
}
84008417

84018418
/*
@@ -8412,7 +8429,7 @@ do_autocmd(char_u *arg, int forceit)
84128429
*/
84138430
last_event = (event_T)-1; /* for listing the event name */
84148431
last_group = AUGROUP_ERROR; /* for listing the group name */
8415-
if (*arg == '*' || *arg == NUL)
8432+
if (*arg == '*' || *arg == NUL || *arg == '|')
84168433
{
84178434
for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
84188435
event = (event_T)((int)event + 1))
@@ -8422,7 +8439,7 @@ do_autocmd(char_u *arg, int forceit)
84228439
}
84238440
else
84248441
{
8425-
while (*arg && !vim_iswhite(*arg))
8442+
while (*arg && *arg != '|' && !vim_iswhite(*arg))
84268443
if (do_autocmd_event(event_name2nr(arg, &arg), pat,
84278444
nested, cmd, forceit, group) == FAIL)
84288445
break;
@@ -8447,7 +8464,8 @@ au_get_grouparg(char_u **argp)
84478464
char_u *arg = *argp;
84488465
int group = AUGROUP_ALL;
84498466

8450-
p = skiptowhite(arg);
8467+
for (p = arg; *p && !vim_iswhite(*p) && *p != '|'; ++p)
8468+
;
84518469
if (p > arg)
84528470
{
84538471
group_name = vim_strnsave(arg, (int)(p - arg));

src/globals.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when
384384

385385
/* When deleting the current buffer, another one must be loaded. If we know
386386
* which one is preferred, au_new_curbuf is set to it */
387-
EXTERN bufref_T au_new_curbuf INIT(= {NULL});
387+
EXTERN bufref_T au_new_curbuf INIT(= {NULL COMMA 0});
388388

389389
/* When deleting a buffer/window and autocmd_busy is TRUE, do not free the
390390
* buffer/window. but link it in the list starting with
@@ -1359,11 +1359,8 @@ EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */
13591359
#ifdef BACKSLASH_IN_FILENAME
13601360
EXTERN char psepc INIT(= '\\'); /* normal path separator character */
13611361
EXTERN char psepcN INIT(= '/'); /* abnormal path separator character */
1362-
EXTERN char pseps[2] /* normal path separator string */
1363-
# ifdef DO_INIT
1364-
= {'\\', 0}
1365-
# endif
1366-
;
1362+
/* normal path separator string */
1363+
EXTERN char pseps[2] INIT(= {'\\' COMMA 0});
13671364
#endif
13681365

13691366
#ifdef FEAT_VIRTUALEDIT

src/option.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,11 @@ EXTERN char_u *p_dir; /* 'directory' */
454454
EXTERN char_u *p_dy; /* 'display' */
455455
EXTERN unsigned dy_flags;
456456
#ifdef IN_OPTION_C
457-
static char *(p_dy_values[]) = {"lastline", "uhex", NULL};
457+
static char *(p_dy_values[]) = {"lastline", "truncate", "uhex", NULL};
458458
#endif
459459
#define DY_LASTLINE 0x001
460-
#define DY_UHEX 0x002
460+
#define DY_TRUNCATE 0x002
461+
#define DY_UHEX 0x004
461462
EXTERN int p_ed; /* 'edcompatible' */
462463
#ifdef FEAT_WINDOWS
463464
EXTERN char_u *p_ead; /* 'eadirection' */

src/screen.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ win_update(win_T *wp)
20182018
&& wp->w_lines[idx].wl_valid
20192019
&& wp->w_lines[idx].wl_lnum == lnum
20202020
&& lnum > wp->w_topline
2021-
&& !(dy_flags & DY_LASTLINE)
2021+
&& !(dy_flags & (DY_LASTLINE | DY_TRUNCATE))
20222022
&& srow + wp->w_lines[idx].wl_size > wp->w_height
20232023
#ifdef FEAT_DIFF
20242024
&& diff_check_fill(wp, lnum) == 0
@@ -2139,6 +2139,21 @@ win_update(win_T *wp)
21392139
wp->w_filler_rows = wp->w_height - srow;
21402140
}
21412141
#endif
2142+
else if (dy_flags & DY_TRUNCATE) /* 'display' has "truncate" */
2143+
{
2144+
int scr_row = W_WINROW(wp) + wp->w_height - 1;
2145+
2146+
/*
2147+
* Last line isn't finished: Display "@@@" in the last screen line.
2148+
*/
2149+
screen_puts_len((char_u *)"@@", 2, scr_row, W_WINCOL(wp),
2150+
hl_attr(HLF_AT));
2151+
screen_fill(scr_row, scr_row + 1,
2152+
(int)W_WINCOL(wp) + 2, (int)W_ENDCOL(wp),
2153+
'@', ' ', hl_attr(HLF_AT));
2154+
set_empty_rows(wp, srow);
2155+
wp->w_botline = lnum;
2156+
}
21422157
else if (dy_flags & DY_LASTLINE) /* 'display' has "lastline" */
21432158
{
21442159
/*

0 commit comments

Comments
 (0)