Trigger DirChanged on 'autochdir'

This commit is contained in:
Marco Hinz 2017-01-12 14:25:11 +01:00
parent 30f775f8a6
commit 197f50bf9a
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 8 additions and 2 deletions

View File

@ -6949,7 +6949,7 @@ void free_cd_dir(void)
#endif
static void apply_autocmd_dirchanged(char_u *new_dir, CdScope scope)
void apply_autocmd_dirchanged(char_u *new_dir, CdScope scope)
{
dict_T *dict = get_vim_var_dict(VV_EVENT);
char buf[8];

View File

@ -51,6 +51,7 @@
#include "nvim/ascii.h"
#include "nvim/file_search.h"
#include "nvim/charset.h"
#include "nvim/ex_docmd.h"
#include "nvim/fileio.h"
#include "nvim/memory.h"
#include "nvim/message.h"
@ -1531,7 +1532,12 @@ int vim_chdirfile(char_u *fname)
STRLCPY(dir, fname, MAXPATHL);
*path_tail_with_sep(dir) = NUL;
return os_chdir((char *)dir) == 0 ? OK : FAIL;
if (os_chdir((char *)dir) != 0) {
return FAIL;
}
apply_autocmd_dirchanged(dir, kCdScopeWindow);
return OK;
}
/// Change directory to "new_dir". Search 'cdpath' for relative directory names.