diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-12-10 18:33:55 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2017-01-02 10:43:45 +0900 |
commit | 0c43479979547ed84b2a898dcc7816767333cc80 (patch) | |
tree | 5ba56dc83b674ef81468d909602647d97f3c8ccc /src/nvim/ex_cmds.c | |
parent | c5f4b92ff93a40ec4e77b78d0576903e7a60eefd (diff) | |
download | rneovim-0c43479979547ed84b2a898dcc7816767333cc80.tar.gz rneovim-0c43479979547ed84b2a898dcc7816767333cc80.tar.bz2 rneovim-0c43479979547ed84b2a898dcc7816767333cc80.zip |
vim-patch:7.4.2015
Problem: When a file gets a name when writing it 'acd' is not effective.
(Dan Church)
Solution: Invoke DO_AUTOCHDIR after writing the file. (Allen Haim, closes
vim/vim#777, closes vim/vim#803) Add test_autochdir() to enable 'acd' before
"starting" is reset.
https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index fcaf17a0fc..b1a17e8c44 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1611,6 +1611,7 @@ int do_write(exarg_T *eap) int retval = FAIL; char_u *free_fname = NULL; buf_T *alt_buf = NULL; + int name_was_missing; if (not_writing()) /* check 'write' option */ return FAIL; @@ -1734,6 +1735,7 @@ int do_write(exarg_T *eap) fname = curbuf->b_sfname; } + name_was_missing = curbuf->b_ffname == NULL; retval = buf_write(curbuf, ffname, fname, eap->line1, eap->line2, eap, eap->append, eap->forceit, TRUE, FALSE); @@ -1743,7 +1745,11 @@ int do_write(exarg_T *eap) curbuf->b_p_ro = FALSE; redraw_tabline = TRUE; } - /* Change directories when the 'acd' option is set. */ + } + + // Change directories when the 'acd' option is set and the file name + // got changed or set. + if (eap->cmdidx == CMD_saveas || name_was_missing) { do_autochdir(); } } |