diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_session.c | 12 | ||||
-rw-r--r-- | src/nvim/testdir/setup.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_mksession.vim | 23 |
3 files changed, 33 insertions, 3 deletions
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 42a9ef08f9..d831ffc050 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -893,6 +893,9 @@ void ex_mkrc(exarg_T *eap) && (*flagp & SSOP_OPTIONS))) { failed |= (makemap(fd, NULL) == FAIL || makeset(fd, OPT_GLOBAL, false) == FAIL); + if (p_hls && fprintf(fd, "%s", "set hlsearch\n") < 0) { + failed = true; + } } if (!failed && view_session) { @@ -949,11 +952,16 @@ void ex_mkrc(exarg_T *eap) } if (fprintf(fd, "%s", - "let &g:so = s:so_save | let &g:siso = s:siso_save\n" - "doautoall SessionLoadPost\n") + "let &g:so = s:so_save | let &g:siso = s:siso_save\n") < 0) { failed = true; } + if (no_hlsearch && fprintf(fd, "%s", "nohlsearch\n") < 0) { + failed = true; + } + if (fprintf(fd, "%s", "doautoall SessionLoadPost\n") < 0) { + failed = true; + } if (eap->cmdidx == CMD_mksession) { if (fprintf(fd, "unlet SessionLoad\n") < 0) { failed = true; diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim index d032c9a739..fd9cfb54be 100644 --- a/src/nvim/testdir/setup.vim +++ b/src/nvim/testdir/setup.vim @@ -20,6 +20,7 @@ set tags=./tags,tags set undodir^=. set wildoptions= set startofline +set sessionoptions&vi " Prevent Nvim log from writing to stderr. let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 215065f941..8ef8bbc23a 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -128,6 +128,7 @@ func Test_mksession() call delete('Xtest_mks.out') call delete(tmpfile) let &wrap = wrap_save + set sessionoptions& endfunc func Test_mksession_winheight() @@ -154,7 +155,7 @@ func Test_mksession_rtp() return endif new - set sessionoptions+=options + set sessionoptions&vi let _rtp=&rtp " Make a real long (invalid) runtimepath value, " that should exceed PATH_MAX (hopefully) @@ -174,6 +175,7 @@ func Test_mksession_rtp() call assert_equal(expected, li) call delete('Xtest_mks.out') + set sessionoptions& endfunc " Verify that arglist is stored correctly to the session file. @@ -218,6 +220,25 @@ func Test_mksession_one_buffer_two_windows() call delete('Xtest_mks.out') endfunc +if has('extra_search') + +func Test_mksession_hlsearch() + set sessionoptions&vi + set hlsearch + mksession! Xtest_mks.out + nohlsearch + 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') + set sessionoptions& + call delete('Xtest_mks.out') +endfunc + +endif + " Test :mkview with a file argument. func Test_mkview_file() " Create a view with line number and a fold. |