patch 9.0.1921: not possible to use the jumplist like a stack
Problem: not possible to use the jumplist like a stack
Solution: Add the 'jumpoptions' setting to make the jumplist
a stack.
Add an option for using jumplist like tag stack
related: #7738
closes: #13134
ported from NeoVim:
- https://neovim.io/doc/user/motion.html#jumplist-stack
- neovim/neovim@39094b3
- neovim/neovim#11530
- https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior
Based on the feedback in the previous PR, it looks like many people like
this option.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
diff --git a/src/optionstr.c b/src/optionstr.c
index 31e30e1..aeeab27 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -35,6 +35,7 @@
#endif
static char *(p_cmp_values[]) = {"internal", "keepascii", NULL};
static char *(p_dy_values[]) = {"lastline", "truncate", "uhex", NULL};
+static char *(p_jop_values[]) = {"stack", NULL};
#ifdef FEAT_FOLDING
static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",
"quickfix", "search", "tag", "insert",
@@ -120,6 +121,7 @@
(void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
#endif
(void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
+ (void)opt_strings_flags(p_jop, p_jop_values, &jop_flags, TRUE);
(void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, FALSE);
(void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
#if defined(UNIX) || defined(VMS)
@@ -1852,6 +1854,18 @@
return NULL;
}
+/*
+ * The 'jumpoptions' option is changed.
+ */
+ char *
+did_set_jumpoptions(optset_T *args)
+{
+ if (opt_strings_flags(p_jop, p_jop_values, &jop_flags, TRUE) != OK)
+ return e_invalid_argument;
+
+ return NULL;
+}
+
#if defined(FEAT_KEYMAP) || defined(PROTO)
/*
* The 'keymap' option is changed.