summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-03 17:36:27 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-03 17:36:27 +0100
commitb7407d3fc9496f9048fb65ab17b5ba3444965c0e (patch)
treeea713a63c3771ff35b52aadef755102b55cc377d /src/ex_docmd.c
parentddb349369d107c14fad9c38baf2f0e2b8514fbf0 (diff)
patch 8.0.1459: cannot handle change of directoryv8.0.1459
Problem: Cannot handle change of directory. Solution: Add the DirChanged autocommand event. (Andy Massimino, closes #888) Avoid changing directory for 'autochdir' too often.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 539e39fb42..cd915c9dae 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -9048,11 +9048,19 @@ ex_cd(exarg_T *eap)
EMSG(_(e_failed));
else
{
- post_chdir(eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir);
+ int is_local_chdir = eap->cmdidx == CMD_lcd
+ || eap->cmdidx == CMD_lchdir;
+
+ post_chdir(is_local_chdir);
/* Echo the new current directory if the command was typed. */
if (KeyTyped || p_verbose >= 5)
ex_pwd(eap);
+#ifdef FEAT_AUTOCMD
+ apply_autocmds(EVENT_DIRCHANGED,
+ is_local_chdir ? (char_u *)"window" : (char_u *)"global",
+ new_dir, FALSE, curbuf);
+#endif
}
vim_free(tofree);
}
@@ -9932,7 +9940,7 @@ ex_mkrc(
*dirnow = NUL;
if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR))
{
- if (vim_chdirfile(fname) == OK)
+ if (vim_chdirfile(fname, NULL) == OK)
shorten_fnames(TRUE);
}
else if (*dirnow != NUL