aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-12-25 21:10:44 -0500
committerGitHub <noreply@github.com>2021-12-25 21:10:44 -0500
commit1dcdf86849d58d6ff5c2ca6728657e7305226a36 (patch)
tree019021929437d1bae0d27cfb24d312e616f40102 /src/nvim/ex_docmd.c
parent8bc7c6fab94a56f034ed459038fa17918886d22e (diff)
parenta5d3dd9359cd727f7c2e89b9b3951d55df4acf5d (diff)
downloadrneovim-1dcdf86849d58d6ff5c2ca6728657e7305226a36.tar.gz
rneovim-1dcdf86849d58d6ff5c2ca6728657e7305226a36.tar.bz2
rneovim-1dcdf86849d58d6ff5c2ca6728657e7305226a36.zip
Merge pull request #16618 from zeertzjq/vim-8.2.3780
vim-patch:8.2.{3780,3784}: ":cd" works differently on MS-Windows
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ee7946fe3e..4d1804cd28 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -7807,14 +7807,17 @@ bool changedir_func(char_u *new_dir, CdScope scope)
prev_dir = pdir;
}
+ // For UNIX ":cd" means: go to home directory.
+ // On other systems too if 'cdhome' is set.
#if defined(UNIX)
- // On 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.
expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
new_dir = NameBuff;
}
-#endif
bool dir_differs = new_dir == NULL || pdir == NULL
|| pathcmp((char *)pdir, (char *)new_dir, -1) != 0;
@@ -7834,9 +7837,9 @@ void ex_cd(exarg_T *eap)
{
char_u *new_dir;
new_dir = eap->arg;
-#if !defined(UNIX) && !defined(VMS)
- // for non-UNIX ":cd" means: print current directory
- if (*new_dir == NUL) {
+#if !defined(UNIX)
+ // for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
+ if (*new_dir == NUL && !p_cdh) {
ex_pwd(NULL);
} else
#endif