Skip to content

Commit d6892b2

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents e06ff0d + dcaa54d commit d6892b2

Some content is hidden

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

90 files changed

+3501
-2370
lines changed

Filelist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ SRC_ALL = \
9898
src/textprop.c \
9999
src/ui.c \
100100
src/undo.c \
101+
src/usercmd.c \
101102
src/userfunc.c \
102103
src/version.c \
103104
src/version.h \
@@ -212,6 +213,7 @@ SRC_ALL = \
212213
src/proto/textprop.pro \
213214
src/proto/ui.pro \
214215
src/proto/undo.pro \
216+
src/proto/usercmd.pro \
215217
src/proto/userfunc.pro \
216218
src/proto/version.pro \
217219
src/proto/winclip.pro \

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@ all install uninstall tools config configure reconfig proto depend lint tags typ
4343
@if test "$@" = "test"; then \
4444
$(MAKE) indenttest; \
4545
fi
46+
@# When the target is "clean" also clean for the indent tests.
47+
@if test "$@" = "clean" -o "$@" = "distclean" -o "$@" = "testclean"; then \
48+
cd runtime/indent && \
49+
$(MAKE) clean; \
50+
fi
4651

4752
# Executable used for running the indent tests.
4853
VIM_FOR_INDENTTEST = ../../src/vim
4954

5055
indenttest:
5156
cd runtime/indent && \
52-
$(MAKE) clean VIM="$(VIM_FOR_INDENTTEST)" && \
57+
$(MAKE) clean && \
5358
$(MAKE) test VIM="$(VIM_FOR_INDENTTEST)"
5459

5560

runtime/doc/autocmd.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*autocmd.txt* For Vim version 8.1. Last change: 2019 Apr 08
1+
*autocmd.txt* For Vim version 8.1. Last change: 2019 Apr 27
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -690,13 +690,14 @@ DiffUpdated After diffs have been updated. Depending on
690690
change or when doing |:diffupdate|.
691691
*DirChanged*
692692
DirChanged The working directory has changed in response
693-
to the |:cd| or |:lcd| commands, or as a
694-
result of the 'autochdir' option.
693+
to the |:cd| or |:tcd| or |:lcd| commands, or
694+
as a result of the 'autochdir' option.
695695
The pattern can be:
696-
"window" to trigger on `:lcd`
697-
"global" to trigger on `:cd`
698-
"auto" to trigger on 'autochdir'.
699-
"drop" to trigger on editing a file
696+
"window" to trigger on `:lcd`
697+
"tabpage" to trigger on `:tcd`
698+
"global" to trigger on `:cd`
699+
"auto" to trigger on 'autochdir'.
700+
"drop" to trigger on editing a file
700701
<afile> is set to the new directory name.
701702
*ExitPre*
702703
ExitPre When using `:quit`, `:wq` in a way it makes

runtime/doc/editing.txt

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,10 @@ use has("browsefilter"): >
13041304
==============================================================================
13051305
7. The current directory *current-directory*
13061306

1307-
You may use the |:cd| and |:lcd| commands to change to another directory, so
1308-
you will not have to type that directory name in front of the file names. It
1309-
also makes a difference for executing external commands, e.g. ":!ls".
1307+
You can use the |:cd|, |:tcd| and |:lcd| commands to change to another
1308+
directory, so you will not have to type that directory name in front of the
1309+
file names. It also makes a difference for executing external commands, e.g.
1310+
":!ls".
13101311

13111312
Changing directory fails when the current buffer is modified, the '.' flag is
13121313
present in 'cpoptions' and "!" is not used in the command.
@@ -1334,6 +1335,17 @@ present in 'cpoptions' and "!" is not used in the command.
13341335
*:chd* *:chdir*
13351336
:chd[ir][!] [path] Same as |:cd|.
13361337

1338+
*:tcd*
1339+
:tcd[!] {path} Like |:cd|, but only set the directory for the current
1340+
tab. The current window will also use this directory.
1341+
The current directory is not changed for windows in
1342+
other tabs and for windows in the current tab that
1343+
have their own window-local directory.
1344+
{not in Vi}
1345+
1346+
*:tch* *:tchdir*
1347+
:tch[dir][!] Same as |:tcd|. {not in Vi}
1348+
13371349
*:lc* *:lcd*
13381350
:lc[d][!] {path} Like |:cd|, but only set the current directory when
13391351
the cursor is in the current window. The current
@@ -1348,17 +1360,26 @@ present in 'cpoptions' and "!" is not used in the command.
13481360
:pw[d] Print the current directory name. {Vi: no pwd}
13491361
Also see |getcwd()|.
13501362

1351-
So long as no |:lcd| command has been used, all windows share the same current
1352-
directory. Using a command to jump to another window doesn't change anything
1353-
for the current directory.
1363+
So long as no |:lcd| or |:tcd| command has been used, all windows share the
1364+
same current directory. Using a command to jump to another window doesn't
1365+
change anything for the current directory.
1366+
13541367
When a |:lcd| command has been used for a window, the specified directory
13551368
becomes the current directory for that window. Windows where the |:lcd|
1356-
command has not been used stick to the global current directory. When jumping
1357-
to another window the current directory will become the last specified local
1358-
current directory. If none was specified, the global current directory is
1359-
used.
1360-
When a |:cd| command is used, the current window will lose his local current
1361-
directory and will use the global current directory from now on.
1369+
command has not been used stick to the global or tab-local current directory.
1370+
When jumping to another window the current directory will become the last
1371+
specified local current directory. If none was specified, the global or
1372+
tab-local current directory is used.
1373+
1374+
When a |:tcd| command has been used for a tab page, the specified directory
1375+
becomes the current directory for the current tab page and the current window.
1376+
The current directory of other tab pages is not affected. When jumping to
1377+
another tab page, the current directory will become the last specified local
1378+
directory for that tab page. If the current tab has no local current directory
1379+
the global current directory is used.
1380+
1381+
When a |:cd| command is used, the current window and tab page will lose the
1382+
local current directory and will use the global current directory from now on.
13621383

13631384
After using |:cd| the full path name will be used for reading and writing
13641385
files. On some networked file systems this may cause problems. The result of

runtime/doc/eval.txt

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.1. Last change: 2019 Apr 21
1+
*eval.txt* For Vim version 8.1. Last change: 2019 Apr 27
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2398,6 +2398,7 @@ has({feature}) Number |TRUE| if feature {feature} supported
23982398
has_key({dict}, {key}) Number |TRUE| if {dict} has entry {key}
23992399
haslocaldir([{winnr} [, {tabnr}]])
24002400
Number |TRUE| if the window executed |:lcd|
2401+
or |:tcd|
24012402
hasmapto({what} [, {mode} [, {abbr}]])
24022403
Number |TRUE| if mapping to {what} exists
24032404
histadd({history}, {item}) String add an item to a history
@@ -4918,9 +4919,28 @@ getcwd([{winnr} [, {tabnr}]])
49184919
directory. See also |haslocaldir()|.
49194920

49204921
With {winnr} and {tabnr} return the local current directory of
4921-
the window in the specified tab page.
4922+
the window in the specified tab page. If {winnr} is -1 return
4923+
the working directory of the tabpage.
4924+
If {winnr} is zero use the current window, if {tabnr} is zero
4925+
use the current tabpage.
4926+
Without any arguments, return the working directory of the
4927+
current window.
49224928
Return an empty string if the arguments are invalid.
49234929

4930+
Examples: >
4931+
" Get the working directory of the current window
4932+
:echo getcwd()
4933+
:echo getcwd(0)
4934+
:echo getcwd(0, 0)
4935+
" Get the working directory of window 3 in tabpage 2
4936+
:echo getcwd(3, 2)
4937+
" Get the global working directory
4938+
:echo getcwd(-1)
4939+
" Get the working directory of tabpage 3
4940+
:echo getcwd(-1, 3)
4941+
" Get the working directory of current tabpage
4942+
:echo getcwd(-1, 0)
4943+
<
49244944
getfsize({fname}) *getfsize()*
49254945
The result is a Number, which is the size in bytes of the
49264946
given file {fname}.
@@ -5478,16 +5498,39 @@ has_key({dict}, {key}) *has_key()*
54785498
an entry with key {key}. Zero otherwise.
54795499

54805500
haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
5481-
The result is a Number, which is 1 when the window has set a
5482-
local path via |:lcd|, and 0 otherwise.
5501+
The result is a Number:
5502+
1 when the window has set a local directory via |:lcd|
5503+
2 when the tab-page has set a local directory via |:tcd|
5504+
0 otherwise.
54835505

54845506
Without arguments use the current window.
54855507
With {winnr} use this window in the current tab page.
54865508
With {winnr} and {tabnr} use the window in the specified tab
54875509
page.
54885510
{winnr} can be the window number or the |window-ID|.
5511+
If {winnr} is -1 it is ignored and only the tabpage is used.
54895512
Return 0 if the arguments are invalid.
5513+
Examples: >
5514+
if haslocaldir() == 1
5515+
" window local directory case
5516+
elseif haslocaldir() == 2
5517+
" tab-local directory case
5518+
else
5519+
" global directory case
5520+
endif
54905521
5522+
" current window
5523+
:echo haslocaldir()
5524+
:echo haslocaldir(0)
5525+
:echo haslocaldir(0, 0)
5526+
" window n in current tab page
5527+
:echo haslocaldir(n)
5528+
:echo haslocaldir(n, 0)
5529+
" window n in tab page m
5530+
:echo haslocaldir(n, m)
5531+
" tab page m
5532+
:echo haslocaldir(-1, m)
5533+
<
54915534
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
54925535
The result is a Number, which is 1 if there is a mapping that
54935536
contains {what} in somewhere in the rhs (what it is mapped to)
@@ -10555,7 +10598,7 @@ ttyin input is a terminal (tty)
1055510598
ttyout output is a terminal (tty)
1055610599
unix Unix version of Vim. *+unix*
1055710600
unnamedplus Compiled with support for "unnamedplus" in 'clipboard'
10558-
user_commands User-defined commands.
10601+
user_commands User-defined commands. (always true)
1055910602
vcon Win32: Virtual console support is working, can use
1056010603
'termguicolors'. Also see |+vtp|.
1056110604
vertsplit Compiled with vertically split windows |:vsplit|.

runtime/doc/index.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,8 @@ tag command action ~
16251625
|:tab| :tab create new tab when opening new window
16261626
|:tag| :ta[g] jump to tag
16271627
|:tags| :tags show the contents of the tag stack
1628+
|:tcd| :tcd change directory for tab page
1629+
|:tchdir| :tch[dir] change directory for tab page
16281630
|:tcl| :tc[l] execute Tcl command
16291631
|:tcldo| :tcld[o] execute Tcl command for each line
16301632
|:tclfile| :tclf[ile] execute Tcl script file

runtime/doc/map.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*map.txt* For Vim version 8.1. Last change: 2018 Dec 18
1+
*map.txt* For Vim version 8.1. Last change: 2019 Apr 25
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1193,9 +1193,10 @@ scripts.
11931193

11941194
:com[mand] *:com* *:command*
11951195
List all user-defined commands. When listing commands,
1196-
the characters in the first two columns are
1196+
the characters in the first columns are:
11971197
! Command has the -bang attribute
11981198
" Command has the -register attribute
1199+
| Command has the -bar attribute
11991200
b Command is local to current buffer
12001201
(see below for details on attributes)
12011202
The list can be filtered on command name with
@@ -1400,14 +1401,15 @@ It is possible that the special characters in the range like ., $ or % which
14001401
by default correspond to the current line, last line and the whole buffer,
14011402
relate to arguments, (loaded) buffers, windows or tab pages.
14021403

1403-
Possible values are:
1404-
-addr=lines Range of lines (this is the default)
1405-
-addr=arguments Range for arguments
1406-
-addr=buffers Range for buffers (also not loaded buffers)
1407-
-addr=loaded_buffers Range for loaded buffers
1408-
-addr=windows Range for windows
1409-
-addr=tabs Range for tab pages
1410-
-addr=other other kind of range
1404+
Possible values are (second column is the short name used in listing):
1405+
-addr=lines Range of lines (this is the default)
1406+
-addr=arguments arg Range for arguments
1407+
-addr=buffers buf Range for buffers (also not loaded buffers)
1408+
-addr=loaded_buffers load Range for loaded buffers
1409+
-addr=windows win Range for windows
1410+
-addr=tabs tab Range for tab pages
1411+
-addr=quickfix qf Range for quickfix entries
1412+
-addr=other ? other kind of range
14111413

14121414

14131415
Special cases ~

runtime/doc/options.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,9 +1468,9 @@ A jump table for the options with a short description can be found at |Q_op|.
14681468
{not available when compiled without the
14691469
|+file_in_path| feature}
14701470
This is a list of directories which will be searched when using the
1471-
|:cd| and |:lcd| commands, provided that the directory being searched
1472-
for has a relative path, not an absolute part starting with "/", "./"
1473-
or "../", the 'cdpath' option is not used then.
1471+
|:cd|, |:tcd| and |:lcd| commands, provided that the directory being
1472+
searched for has a relative path, not an absolute part starting with
1473+
"/", "./" or "../", the 'cdpath' option is not used then.
14741474
The 'cdpath' option's value has the same form and semantics as
14751475
|'path'|. Also see |file-searching|.
14761476
The default value is taken from $CDPATH, with a "," prepended to look

runtime/doc/usr_22.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,28 @@ the other window. This is called a local directory. >
202202
:pwd
203203
/home/Bram/VeryLongFileName
204204
205-
So long as no ":lcd" command has been used, all windows share the same current
206-
directory. Doing a ":cd" command in one window will also change the current
205+
So long as no `:lcd` command has been used, all windows share the same current
206+
directory. Doing a `:cd` command in one window will also change the current
207207
directory of the other window.
208-
For a window where ":lcd" has been used a different current directory is
209-
remembered. Using ":cd" or ":lcd" in other windows will not change it.
210-
When using a ":cd" command in a window that uses a different current
208+
For a window where `:lcd` has been used a different current directory is
209+
remembered. Using `:cd` or `:lcd` in other windows will not change it.
210+
When using a `:cd` command in a window that uses a different current
211211
directory, it will go back to using the shared directory.
212212

213+
214+
TAB LOCAL DIRECTORY
215+
216+
When you open a new tab page, it uses the directory of the window in the
217+
previous tab page from which the new tab page was opened. You can change the
218+
directory of the current tab page using the `:tcd` command. All the windows in
219+
a tab page share this directory except for windows with a window-local
220+
directory. Any new windows opened in this tab page will use this directory as
221+
the current working directory. Using a `:cd` command in a tab page will not
222+
change the working directory of tab pages which have a tab local directory.
223+
When the global working directory is changed using the ":cd" command in a tab
224+
page, it will also change the current tab page working directory.
225+
226+
213227
==============================================================================
214228
*22.3* Finding a file
215229

runtime/doc/usr_41.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ System functions and manipulation of files:
766766
isdirectory() check if a directory exists
767767
getfsize() get the size of a file
768768
getcwd() get the current working directory
769-
haslocaldir() check if current window used |:lcd|
769+
haslocaldir() check if current window used |:lcd| or |:tcd|
770770
tempname() get the name of a temporary file
771771
mkdir() create a new directory
772772
delete() delete a file

0 commit comments

Comments
 (0)