diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-02-07 01:01:03 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-07 01:01:03 -0500 |
commit | bd3ea7227ee04a913c1cc5487979ad67dda290f9 (patch) | |
tree | c36e9637838c77930c41ccf0963acf6166e486f5 | |
parent | 0ef0c178371d41398d932cfc21beec31cfdbc65f (diff) | |
parent | 1ecbfd19db9c45d25c6793cedf019e30bf4a30a3 (diff) | |
download | rneovim-bd3ea7227ee04a913c1cc5487979ad67dda290f9.tar.gz rneovim-bd3ea7227ee04a913c1cc5487979ad67dda290f9.tar.bz2 rneovim-bd3ea7227ee04a913c1cc5487979ad67dda290f9.zip |
Merge pull request #4176 from watiko/vim-7.4.689
vim-patch:7.4.689
-rw-r--r-- | src/nvim/main.c | 42 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 26 insertions, 18 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index cef10d12d5..a8c2cebbbd 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -219,9 +219,10 @@ int main(int argc, char **argv) { argv0 = (char *)path_tail((char_u *)argv[0]); - char_u *fname = NULL; /* file name from command line */ - mparm_T params; /* various parameters passed between - * main() and other functions. */ + char_u *fname = NULL; // file name from command line + mparm_T params; // various parameters passed between + // main() and other functions. + char_u *cwd = NULL; // current workding dir on startup time_init(); /* Many variables are in "params" so that we can pass them to invoked @@ -461,11 +462,10 @@ int main(int argc, char **argv) TIME_MSG("jump to first error"); } - /* - * If opened more than one window, start editing files in the other - * windows. - */ - edit_buffers(¶ms); + // If opened more than one window, start editing files in the other + // windows. + edit_buffers(¶ms, cwd); + xfree(cwd); if (params.diff_mode) { /* set options in each window for "nvim -d". */ @@ -1182,12 +1182,19 @@ static char_u *get_fname(mparm_T *parmp) * Expand wildcards in file names. */ if (!parmp->literal) { - /* Temporarily add '(' and ')' to 'isfname'. These are valid - * filename characters but are excluded from 'isfname' to make - * "gf" work on a file name in parenthesis (e.g.: see vim.h). */ + cwd = xmalloc(MAXPATHL); + if (cwd != NULL) { + os_dirname(cwd, MAXPATHL); + } + // Temporarily add '(' and ')' to 'isfname'. These are valid + // filename characters but are excluded from 'isfname' to make + // "gf" work on a file name in parenthesis (e.g.: see vim.h). do_cmdline_cmd(":set isf+=(,)"); alist_expand(NULL, 0); do_cmdline_cmd(":set isf&"); + if (cwd != NULL) { + os_chdir((char *)cwd); + } } #endif return alist_name(&GARGLIST[0]); @@ -1417,11 +1424,9 @@ static void create_windows(mparm_T *parmp) } } -/* - * If opened more than one window, start editing files in the other - * windows. make_windows() has already opened the windows. - */ -static void edit_buffers(mparm_T *parmp) +/// If opened more than one window, start editing files in the other +/// windows. make_windows() has already opened the windows. +static void edit_buffers(mparm_T *parmp, char_u *cwd) { int arg_idx; /* index in argument list */ int i; @@ -1442,7 +1447,10 @@ static void edit_buffers(mparm_T *parmp) arg_idx = 1; for (i = 1; i < parmp->window_count; ++i) { - /* When w_arg_idx is -1 remove the window (see create_windows()). */ + if (cwd != NULL) { + os_chdir((char *)cwd); + } + // When w_arg_idx is -1 remove the window (see create_windows()). if (curwin->w_arg_idx == -1) { ++arg_idx; win_close(curwin, TRUE); diff --git a/src/nvim/version.c b/src/nvim/version.c index 7b9e1de028..d8cd0182a8 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -599,7 +599,7 @@ static int included_patches[] = { // 692 NA // 691 NA 690, - // 689, + 689, 688, // 687 NA 686, |