vim-patch:8.2.3780: ":cd" works differently on MS-Windows

Problem:    ":cd" works differently on MS-Windows.
Solution:   Add the 'cdhome' option. (closes vim/vim#9324)
29f3a45915
This commit is contained in:
zeertzjq
2021-12-25 11:31:54 +08:00
parent 0d7a97224f
commit 42cf76fd0a
8 changed files with 52 additions and 12 deletions

View File

@@ -1253,10 +1253,12 @@ working directory. If a local working directory (tab or window) does not
exist, the next-higher scope in the hierarchy applies.
*:cd* *E747* *E472*
:cd[!] On non-Unix systems: Print the current directory
name. On Unix systems: Change the current directory
to the home directory. Use |:pwd| to print the
current directory on all systems.
:cd[!] On non-Unix systems when 'cdhome' is off: Print the
current directory name.
Otherwise: Change the current directory to the home
directory. Clear any window-local directory.
Use |:pwd| to print the current directory on all
systems.
:cd[!] {path} Change the current directory to {path}.
If {path} is relative, it is searched for in the

View File

@@ -629,6 +629,7 @@ Short explanation of each option: *option-list*
'buflisted' 'bl' whether the buffer shows up in the buffer list
'buftype' 'bt' special type of buffer
'casemap' 'cmp' specifies how case of letters is changed
'cdhome' 'cdh' change directory to the home directory by ":cd"
'cdpath' 'cd' list of directories searched with ":cd"
'cedit' key used to open the command-line window
'charconvert' 'ccv' expression for character encoding conversion

View File

@@ -261,6 +261,10 @@ call <SID>OptionG("sect", &sect)
call append("$", "path\tlist of directory names used for file searching")
call append("$", "\t(global or local to buffer)")
call <SID>OptionG("pa", &pa)
if exists("+cdhome")
call <SID>AddOption("cdhome", "change directory to the home directory by :cd")
call <SID>BinOptionG("cdh", &cdh)
endif
call append("$", "cdpath\tlist of directory names used for :cd")
call <SID>OptionG("cd", &cd)
if exists("+autochdir")