diff src/optionstr.c @ 33311:1f3bcb7f3bd0 v9.0.1921

patch 9.0.1921: not possible to use the jumplist like a stack Commit: https://github.com/vim/vim/commit/87018255e3ad0f4dfa03e20318836d24af721caf Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Wed Sep 20 20:20:04 2023 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Wed, 20 Sep 2023 20:30:06 +0200
parents 161ae1985d81
children 41e2414d2886
line wrap: on
line diff
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -35,6 +35,7 @@ static char *(p_cm_values[]) = {"zip", "
 #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 @@ didset_string_options(void)
     (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 @@ did_set_isopt(optset_T *args)
     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.