Skip to content

Commit 0a1cf2e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 6b7d2cf + 4792a67 commit 0a1cf2e

45 files changed

Lines changed: 1765 additions & 862 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runtime/doc/autocmd.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,15 @@ CmdlineChanged After a change was made to the text in the
553553
*CmdlineEnter*
554554
CmdlineEnter After moving the cursor to the command line,
555555
where the user can type a command or search
556-
string.
556+
string; including non-interactive use of ":"
557+
in a mapping, but not when using |<Cmd>|.
557558
<afile> is set to a single character,
558559
indicating the type of command-line.
559560
|cmdwin-char|
560561
*CmdlineLeave*
561-
CmdlineLeave Before leaving the command line.
562+
CmdlineLeave Before leaving the command line; including
563+
non-interactive use of ":" in a mapping, but
564+
not when using |<Cmd>|.
562565
Also when abandoning the command line, after
563566
typing CTRL-C or <Esc>.
564567
When the commands result in an error the

runtime/doc/eval.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8672,6 +8672,7 @@ screencol() *screencol()*
86728672
the following mappings: >
86738673
nnoremap <expr> GG ":echom ".screencol()."\n"
86748674
nnoremap <silent> GG :echom screencol()<CR>
8675+
nnoremap GG <Cmd>echom screencol()<CR>
86758676
<
86768677
screenpos({winid}, {lnum}, {col}) *screenpos()*
86778678
The result is a Dict with the screen position of the text

runtime/doc/map.txt

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*map.txt* For Vim version 8.2. Last change: 2020 Oct 07
1+
*map.txt* For Vim version 8.2. Last change: 2020 Nov 12
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -271,7 +271,7 @@ For this reason the following is blocked:
271271
- The |:normal| command.
272272
- Moving the cursor is allowed, but it is restored afterwards.
273273
If you want the mapping to do any of these let the returned characters do
274-
that.
274+
that, or use a |<Cmd>| mapping instead.
275275

276276
You can use getchar(), it consumes typeahead if there is any. E.g., if you
277277
have these mappings: >
@@ -303,6 +303,40 @@ empty string, so that nothing is inserted.
303303
Note that using 0x80 as a single byte before other text does not work, it will
304304
be seen as a special key.
305305

306+
*<Cmd>* *:map-cmd*
307+
The special text <Cmd> begins a "command mapping", it executes the command
308+
directly without changing modes. Where you might use ":...<CR>" in the
309+
{rhs} of a mapping, you can instead use "<Cmd>...<CR>".
310+
Example: >
311+
noremap x <Cmd>echo mode(1)<CR>
312+
<
313+
This is more flexible than `:<C-U>` in Visual and Operator-pending mode, or
314+
`<C-O>:` in Insert mode, because the commands are executed directly in the
315+
current mode, instead of always going to Normal mode. Visual mode is
316+
preserved, so tricks with |gv| are not needed. Commands can be invoked
317+
directly in Command-line mode (which would otherwise require timer hacks).
318+
Example of using <Cmd> halfway Insert mode: >
319+
nnoremap <F3> aText <Cmd>echo mode(1)<CR> Added<Esc>
320+
321+
Unlike <expr> mappings, there are no special restrictions on the <Cmd>
322+
command: it is executed as if an (unrestricted) |autocmd| was invoked.
323+
324+
Note:
325+
- Because <Cmd> avoids mode-changes it does not trigger |CmdlineEnter| and
326+
|CmdlineLeave| events, because no user interaction is expected.
327+
- For the same reason, |keycodes| like <C-R><C-W> are interpreted as plain,
328+
unmapped keys.
329+
- In Select mode, |:map| and |:vmap| command mappings are executed in
330+
Visual mode. Use |:smap| to handle Select mode differently.
331+
332+
*E1135* *E1136*
333+
<Cmd> commands must terminate, that is, they must be followed by <CR> in the
334+
{rhs} of the mapping definition. |Command-line| mode is never entered.
335+
336+
*E1137*
337+
<Cmd> commands can have only normal characters and cannot contain special
338+
characters like function keys.
339+
306340

307341
1.3 MAPPING AND MODES *:map-modes*
308342
*mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o*

src/INSTALLpc.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,6 @@ For building 64 bit binaries you also need to install the SDK:
264264
"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1"
265265
You don't need the examples and documentation.
266266

267-
If you get an error that Win32.mak can't be found, you have to set the
268-
variable SDK_INCLUDE_DIR. For example, on Windows 10, installation of MSVC
269-
puts include files in the following directory:
270-
set SDK_INCLUDE_DIR=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
271-
272267

273268
2. MSYS2 with MinGW
274269
===================

src/Make_cyg_ming.mak

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,12 @@ install.exe: dosinst.c dosinst.h version.h
10551055
uninstall.exe: uninstall.c dosinst.h version.h
10561056
$(CC) $(CFLAGS) -o uninstall.exe uninstall.c $(LIB) -lole32
10571057

1058+
$(OBJ): $(OUTDIR)
1059+
1060+
$(EXEOBJG): $(OUTDIR)
1061+
1062+
$(EXEOBJC): $(OUTDIR)
1063+
10581064
ifeq ($(VIMDLL),yes)
10591065
$(TARGET): $(OUTDIR) $(OBJ)
10601066
$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -lgdi32 $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
@@ -1280,7 +1286,7 @@ $(OUTDIR)/%.o : xdiff/%.c $(XDIFF_DEPS)
12801286
$(CC) -c $(CFLAGS) $< -o $@
12811287

12821288

1283-
$(PATHDEF_SRC): Make_cyg_ming.mak Make_cyg.mak Make_ming.mak
1289+
$(PATHDEF_SRC): $(OUTDIR) Make_cyg_ming.mak Make_cyg.mak Make_ming.mak
12841290
ifneq (sh.exe, $(SHELL))
12851291
@echo creating $(PATHDEF_SRC)
12861292
@echo '/* pathdef.c */' > $(PATHDEF_SRC)

src/Make_mvc.mak

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
# This will build the console version of Vim with no additional interfaces.
1616
# To add features, define any of the following:
1717
#
18-
# For MSVC 11, if you want to include Win32.mak, you need to specify
19-
# where the file is, e.g.:
20-
# SDK_INCLUDE_DIR="C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
21-
#
22-
# !!!! After changing features do "nmake clean" first !!!!
18+
# !!!! After changing any features do "nmake clean" first !!!!
2319
#
2420
# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is HUGE)
2521
#
@@ -209,9 +205,6 @@ OBJDIR = $(OBJDIR)V
209205
OBJDIR = $(OBJDIR)d
210206
!endif
211207

212-
# If you include Win32.mak, it requires that CPU be set appropriately.
213-
# To cross-compile for Win64, set CPU=AMD64 or CPU=IA64.
214-
215208
!ifdef PROCESSOR_ARCHITECTURE
216209
# We're on Windows NT or using VC 6+
217210
! ifdef CPU
@@ -251,18 +244,7 @@ NODEBUG = 1
251244
MAKEFLAGS_GVIMEXT = DEBUG=yes
252245
!endif
253246

254-
255-
# Get all sorts of useful, standard macros from the Platform SDK,
256-
# if SDK_INCLUDE_DIR is set or USE_WIN32MAK is set to "yes".
257-
258-
!ifdef SDK_INCLUDE_DIR
259-
! include $(SDK_INCLUDE_DIR)\Win32.mak
260-
!elseif "$(USE_WIN32MAK)"=="yes"
261-
! include <Win32.mak>
262-
!else
263247
link = link
264-
!endif
265-
266248

267249
# Check VC version.
268250
!if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul]

src/drawline.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,6 +2455,7 @@ win_line(
24552455
wp->w_wrow = row;
24562456
did_wcol = TRUE;
24572457
curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
2458+
curwin->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
24582459
}
24592460
#endif
24602461

src/edit.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,15 @@ edit(
10401040
case K_IGNORE: // Something mapped to nothing
10411041
break;
10421042

1043+
case K_COMMAND: // <Cmd>command<CR>
1044+
do_cmdline(NULL, getcmdkeycmd, NULL, 0);
1045+
#ifdef FEAT_TERMINAL
1046+
if (term_use_loop())
1047+
// Started a terminal that gets the input, exit Insert mode.
1048+
goto doESCkey;
1049+
#endif
1050+
break;
1051+
10431052
case K_CURSORHOLD: // Didn't type something for a while.
10441053
ins_apply_autocmds(EVENT_CURSORHOLDI);
10451054
did_cursorhold = TRUE;
@@ -3955,8 +3964,11 @@ ins_bs(
39553964
#endif
39563965
((curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0)
39573966
|| (!can_bs(BS_START)
3958-
&& (arrow_used
3959-
|| (curwin->w_cursor.lnum == Insstart_orig.lnum
3967+
&& ((arrow_used
3968+
#ifdef FEAT_JOB_CHANNEL
3969+
&& !bt_prompt(curbuf)
3970+
#endif
3971+
) || (curwin->w_cursor.lnum == Insstart_orig.lnum
39603972
&& curwin->w_cursor.col <= Insstart_orig.col)))
39613973
|| (!can_bs(BS_INDENT) && !arrow_used && ai_col > 0
39623974
&& curwin->w_cursor.col <= ai_col)

src/errors.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ EXTERN char e_compiling_def_function_failed[]
8989
INIT(= N_("E1028: Compiling :def function failed"));
9090
EXTERN char e_expected_str_but_got_str[]
9191
INIT(= N_("E1029: Expected %s but got %s"));
92-
EXTERN char e_using_string_as_number[]
93-
INIT(= N_("E1030: Using a String as a Number"));
92+
EXTERN char e_using_string_as_number_str[]
93+
INIT(= N_("E1030: Using a String as a Number: \"%s\""));
9494
EXTERN char e_cannot_use_void_value[]
9595
INIT(= N_("E1031: Cannot use void value"));
9696
EXTERN char e_missing_catch_or_finally[]
@@ -292,4 +292,12 @@ EXTERN char e_cannot_extend_null_dict[]
292292
INIT(= N_("E1133: Cannot extend a null dict"));
293293
EXTERN char e_cannot_extend_null_list[]
294294
INIT(= N_("E1134: Cannot extend a null list"));
295+
EXTERN char e_using_string_as_bool_str[]
296+
INIT(= N_("E1135: Using a String as a Bool: \"%s\""));
295297
#endif
298+
EXTERN char e_cmd_mapping_must_end_with_cr[]
299+
INIT(=N_("E1135: <Cmd> mapping must end with <CR>"));
300+
EXTERN char e_cmd_mapping_must_end_with_cr_before_second_cmd[]
301+
INIT(=N_("E1136: <Cmd> mapping must end with <CR> before second <Cmd>"));
302+
EXTERN char e_cmd_maping_must_not_include_str_key[]
303+
INIT(= N_("E1137: <Cmd> mapping must not include %s key"));

src/eval.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3438,7 +3438,15 @@ eval7_leader(
34383438
}
34393439
#ifdef FEAT_FLOAT
34403440
if (rettv->v_type == VAR_FLOAT)
3441-
f = !f;
3441+
{
3442+
if (in_vim9script())
3443+
{
3444+
rettv->v_type = VAR_BOOL;
3445+
val = f == 0.0 ? VVAL_TRUE : VVAL_FALSE;
3446+
}
3447+
else
3448+
f = !f;
3449+
}
34423450
else
34433451
#endif
34443452
{

0 commit comments

Comments
 (0)