aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Roberts <notthebmovieactor@gmail.com>2017-10-27 10:48:24 -0400
committerJustin M. Keyes <justinkz@gmail.com>2017-11-18 12:02:15 +0100
commita6de144c3e5cc888ab3cb7c2034a762b23566919 (patch)
tree7a6368c0786b50ace0953cfa1a1bdcf7a8f6be50 /src
parentf185c739bc843705bf46e844cb209b3f6b2de557 (diff)
downloadrneovim-a6de144c3e5cc888ab3cb7c2034a762b23566919.tar.gz
rneovim-a6de144c3e5cc888ab3cb7c2034a762b23566919.tar.bz2
rneovim-a6de144c3e5cc888ab3cb7c2034a762b23566919.zip
'viewoptions': add "curdir" flag #7447
The flag enables the current local directory set by ":lcd" to be saved to views which is the current default behaviour. The option can be removed to disable this behaviour. closes #7435 vim-patch:8.0.1289
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c15
-rw-r--r--src/nvim/option_defs.h21
-rw-r--r--src/nvim/options.lua2
3 files changed, 21 insertions, 17 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 7a2b0328df..5180420eff 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -9356,15 +9356,18 @@ put_view (
}
}
- /*
- * Local directory.
- */
- if (wp->w_localdir != NULL) {
+ //
+ // Local directory, if the current flag is not view options or the "curdir"
+ // option is included.
+ //
+ if (wp->w_localdir != NULL
+ && (flagp != &vop_flags || (*flagp & SSOP_CURDIR))) {
if (fputs("lcd ", fd) < 0
|| ses_put_fname(fd, wp->w_localdir, flagp) == FAIL
- || put_eol(fd) == FAIL)
+ || put_eol(fd) == FAIL) {
return FAIL;
- did_lcd = TRUE;
+ }
+ did_lcd = true;
}
return OK;
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index a2fe90b3c2..1f62490ab9 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -539,7 +539,7 @@ static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
"localoptions", "options", "help", "blank",
"globals", "slash", "unix",
"sesdir", "curdir", "folds", "cursor",
- "tabpages", NULL};
+ "tabpages", NULL };
# endif
# define SSOP_BUFFERS 0x001
# define SSOP_WINPOS 0x002
@@ -557,16 +557,17 @@ static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
# define SSOP_FOLDS 0x2000
# define SSOP_CURSOR 0x4000
# define SSOP_TABPAGES 0x8000
-EXTERN char_u *p_sh; /* 'shell' */
-EXTERN char_u *p_shcf; /* 'shellcmdflag' */
-EXTERN char_u *p_sp; /* 'shellpipe' */
-EXTERN char_u *p_shq; /* 'shellquote' */
-EXTERN char_u *p_sxq; /* 'shellxquote' */
-EXTERN char_u *p_sxe; /* 'shellxescape' */
-EXTERN char_u *p_srr; /* 'shellredir' */
-EXTERN int p_stmp; /* 'shelltemp' */
+
+EXTERN char_u *p_sh; // 'shell'
+EXTERN char_u *p_shcf; // 'shellcmdflag'
+EXTERN char_u *p_sp; // 'shellpipe'
+EXTERN char_u *p_shq; // 'shellquote'
+EXTERN char_u *p_sxq; // 'shellxquote'
+EXTERN char_u *p_sxe; // 'shellxescape'
+EXTERN char_u *p_srr; // 'shellredir'
+EXTERN int p_stmp; // 'shelltemp'
#ifdef BACKSLASH_IN_FILENAME
-EXTERN int p_ssl; /* 'shellslash' */
+EXTERN int p_ssl; // 'shellslash'
#endif
EXTERN char_u *p_stl; // 'statusline'
EXTERN int p_sr; // 'shiftround'
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 29220a6b50..52e478e78a 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -2610,7 +2610,7 @@ return {
deny_duplicates=true,
vi_def=true,
varname='p_vop',
- defaults={if_true={vi="folds,options,cursor"}}
+ defaults={if_true={vi="folds,options,cursor,curdir"}}
},
{
full_name='viminfo', abbreviation='vi',