summaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-03 18:33:17 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-03 18:33:17 +0100
commit15833239a4131279935a4bd574b74fe3a2b0f49f (patch)
treef41211326ba22675a46c6035751fc0f37537c8b7 /src/ex_cmds.c
parentb5cb65ba2bcc6bbc6d2798a2dea18b95f0b38f5e (diff)
downloadvim-git-15833239a4131279935a4bd574b74fe3a2b0f49f.tar.gz
patch 8.0.1461: missing another file in patchv8.0.1461
Problem: Missing another file in patch. Solution: Add changes to missing file.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 91f5124de..f4129019a 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4368,8 +4368,22 @@ do_ecmd(
if (p_im)
need_start_insertmode = TRUE;
- /* Change directories when the 'acd' option is set. */
- DO_AUTOCHDIR
+#ifdef FEAT_AUTOCHDIR
+ /* Change directories when the 'acd' option is set and we aren't already in
+ * that directory (should already be done above). Expect getcwd() to be
+ * faster than calling shorten_fnames() unnecessarily. */
+ if (p_acd && curbuf->b_ffname != NULL)
+ {
+ char_u curdir[MAXPATHL];
+ char_u filedir[MAXPATHL];
+
+ vim_strncpy(filedir, curbuf->b_ffname, MAXPATHL - 1);
+ *gettail_sep(filedir) = NUL;
+ if (mch_dirname(curdir, MAXPATHL) != FAIL
+ && vim_fnamecmp(curdir, filedir) != 0)
+ do_autochdir();
+ }
+#endif
#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
if (curbuf->b_ffname != NULL)