I've been adding Vim sessions to my workflow lately, and
I noticed that sessions don't restore search highlighting
properly. That is, my session does not remember that I have
invoked the ":nohlsearch" command. The test below fails...
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index fa08685ac..afe4971d9 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -198,6 +198,22 @@ func Test_mksession_blank_tabs()
call delete('Xtest_mks.out')
endfunc
+if has('extra_search')
+
+func Test_mksession_hlsearch()
+ set hlsearch
+ mksession! Xtest_mks.out
+ source Xtest_mks.out
+ call assert_equal(1, v:hlsearch, 'session should restore search highlighting
state')
+ nohlsearch
+ mksession! Xtest_mks.out
+ source Xtest_mks.out
+ call assert_equal(0, v:hlsearch, 'session should restore search highlighting
state')
+ call delete('Xtest_mks.out')
+endfunc
+
+endif
+
func Test_mksession_blank_windows()
split
split
I fixed the problem with the following patch:
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 354cc119b..8f7ec67d4 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10144,6 +10144,10 @@ ex_mkrc(
if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save")
== FAIL)
failed = TRUE;
+# ifdef FEAT_SEARCH_EXTRA
+ if (no_hlsearch)
+ put_line(fd, "nohlsearch");
+# endif
if (put_line(fd, "doautoall SessionLoadPost") == FAIL)
failed = TRUE;
if (eap->cmdidx == CMD_mksession)
Let me know if anything needs adjustment.
Best,
Jason Franklin
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.