1
0
forked from aniani/vim

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

Problem:    ":cd" works differently on MS-Windows.
Solution:   Add the 'cdhome' option. (closes #9324)
This commit is contained in:
Bakudankun
2021-12-11 12:28:08 +00:00
committed by Bram Moolenaar
parent 205f29c3e9
commit 29f3a45915
9 changed files with 49 additions and 12 deletions

View File

@@ -7402,9 +7402,13 @@ changedir_func(
else
prev_dir = pdir;
// For UNIX ":cd" means: go to home directory.
// On other systems too if 'cdhome' is set.
#if defined(UNIX) || defined(VMS)
// for UNIX ":cd" means: go to home directory
if (*new_dir == NUL)
#else
if (*new_dir == NUL && p_cdh)
#endif
{
// use NameBuff for home directory name
# ifdef VMS
@@ -7420,7 +7424,6 @@ changedir_func(
# endif
new_dir = NameBuff;
}
#endif
dir_differs = new_dir == NULL || pdir == NULL
|| pathcmp((char *)pdir, (char *)new_dir, -1) != 0;
if (new_dir == NULL || (dir_differs && vim_chdir(new_dir)))
@@ -7459,8 +7462,8 @@ ex_cd(exarg_T *eap)
new_dir = eap->arg;
#if !defined(UNIX) && !defined(VMS)
// for non-UNIX ":cd" means: print current directory
if (*new_dir == NUL)
// for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
if (*new_dir == NUL && !p_cdh)
ex_pwd(NULL);
else
#endif