aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2021-12-25 11:31:54 +0800
committerzeertzjq <zeertzjq@outlook.com>2021-12-25 11:31:54 +0800
commit42cf76fd0ab2afe3ca633d0d6600c8a771731f57 (patch)
tree25d8bd975f6185db2fc65616ec28c045ff664b7f /src/nvim/ex_docmd.c
parent0d7a97224f28cdf47d7ecc80b6d300c8c67c0b29 (diff)
downloadrneovim-42cf76fd0ab2afe3ca633d0d6600c8a771731f57.tar.gz
rneovim-42cf76fd0ab2afe3ca633d0d6600c8a771731f57.tar.bz2
rneovim-42cf76fd0ab2afe3ca633d0d6600c8a771731f57.zip
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) https://github.com/vim/vim/commit/29f3a4591528130fded3fe1d63d74bcf22ab4f6c
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