diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index fa3ceb1142..60fc16f7e4 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5052,6 +5052,7 @@ A jump table for the options with a short description can be found at |Q_op|. global values for local options) options all options and mappings (also global values for local options) + skiprtp exclude 'runtimepath' from the options resize size of the Vim window: 'lines' and 'columns' sesdir the directory in which the session file is located will become the current directory (useful with diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index c22c1f428d..c1e52d6994 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -937,8 +937,13 @@ void ex_mkrc(exarg_T *eap) if (!view_session || (eap->cmdidx == CMD_mksession && (*flagp & SSOP_OPTIONS))) { + int flags = OPT_GLOBAL; + + if (eap->cmdidx == CMD_mksession && (*flagp & SSOP_SKIP_RTP)) { + flags |= OPT_SKIPRTP; + } failed |= (makemap(fd, NULL) == FAIL - || makeset(fd, OPT_GLOBAL, false) == FAIL); + || makeset(fd, flags, false) == FAIL); } if (!failed && view_session) { diff --git a/src/nvim/option.c b/src/nvim/option.c index ad481af7fa..b33571ccc2 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5232,6 +5232,10 @@ int makeset(FILE *fd, int opt_flags, int local_only) continue; } + if ((opt_flags & OPT_SKIPRTP) && p->var == (char_u *)&p_rtp) { + continue; + } + round = 2; if (p->indir != PV_NONE) { if (p->var == VAR_WIN) { diff --git a/src/nvim/option.h b/src/nvim/option.h index 60f14dea44..c6ee03e052 100644 --- a/src/nvim/option.h +++ b/src/nvim/option.h @@ -19,6 +19,9 @@ typedef enum { OPT_MODELINE = 8, ///< Option in modeline. OPT_WINONLY = 16, ///< Only set window-local options. OPT_NOWIN = 32, ///< Don’t set window-local options. + OPT_ONECOLUMN = 64, ///< list options one per line + OPT_NO_REDRAW = 128, ///< ignore redraw flags on option + OPT_SKIPRTP = 256, ///< "skiprtp" in 'sessionoptions' } OptionFlags; #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 62df28c55e..beb62a6a0b 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -572,11 +572,12 @@ EXTERN char_u *p_slm; // 'selectmode' EXTERN char_u *p_ssop; // 'sessionoptions' EXTERN unsigned ssop_flags; # ifdef IN_OPTION_C -// Also used for 'viewoptions'! +// Also used for 'viewoptions'! Keep in sync with SSOP_ flags. static char *(p_ssop_values[]) = { "buffers", "winpos", "resize", "winsize", "localoptions", "options", "help", "blank", "globals", "slash", "unix", - "sesdir", "curdir", "folds", "cursor", "tabpages", NULL + "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", "skiprtp", + NULL }; # endif # define SSOP_BUFFERS 0x001 @@ -595,6 +596,8 @@ static char *(p_ssop_values[]) = { # define SSOP_FOLDS 0x2000 # define SSOP_CURSOR 0x4000 # define SSOP_TABPAGES 0x8000 +# define SSOP_TERMINAL 0x10000 +# define SSOP_SKIP_RTP 0x20000 EXTERN char_u *p_sh; // 'shell' EXTERN char_u *p_shcf; // 'shellcmdflag'