From d1c3d6fbaaf6fcbeb78151b99b9a8618588a5d1b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 6 May 2026 07:23:16 +0800 Subject: [PATCH] vim-patch:9.2.0444: Cannot set 'path' option via modeline Problem: Cannot set 'path' option via modeline (zeertzjq, after v9.2.0435) Solution: Revert the part that disallows setting 'path' via modeline. closes: vim/vim#20137 https://github.com/vim/vim/commit/88fb739918a0d2ca4277e1e79b4fd5799e9b0128 Co-authored-by: Christian Brabandt --- runtime/doc/options.txt | 1 - src/nvim/options.lua | 1 - test/old/testdir/test_find_complete.vim | 9 ++++++++- test/old/testdir/test_modeline.vim | 14 -------------- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a5e3d3d686..4878484f7d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4806,7 +4806,6 @@ A jump table for the options with a short description can be found at |Q_op|. *'path'* *'pa'* *E343* *E345* *E347* *E854* 'path' 'pa' string (default ".,,") global or local to buffer |global-local| - Disallowed in |modeline|. |no-modeline-option| This is a list of directories which will be searched when using the |gf|, [f, ]f, ^Wf, |:find|, |:sfind|, |:tabfind| and other commands, provided that the file being searched for has a relative path (not diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 003f2aebd4..f9ed8c0480 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -6556,7 +6556,6 @@ local options = { full_name = 'path', list = 'comma', scope = { 'global', 'buf' }, - secure = true, short_desc = N_('list of directories searched with "gf" et.al.'), tags = { 'E343', 'E345', 'E347', 'E854' }, type = 'string', diff --git a/test/old/testdir/test_find_complete.vim b/test/old/testdir/test_find_complete.vim index 8b8b71c303..ee36725d5f 100644 --- a/test/old/testdir/test_find_complete.vim +++ b/test/old/testdir/test_find_complete.vim @@ -165,9 +165,15 @@ endfunc func Test_find_completion_backtick_in_path() CheckUnix CheckExecutable id + set modeline "nomodelinestrict + let lines =<< trim END + // vim: set path+=`id>Xrce_marker` : + END + + call writefile(lines, 'Xpoc.c', 'D') new Xpoc.c - setl path+=`id>Xrce_marker` + call assert_match('`id>Xrce_marker`', &path) " Triggering completion must not execute the backtick command. call getcompletion('', 'file_in_path') call assert_false(filereadable('Xrce_marker')) @@ -176,6 +182,7 @@ func Test_find_completion_backtick_in_path() bwipe! call delete('Xrce_marker') + set modeline& "modelinestrict& endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_modeline.vim b/test/old/testdir/test_modeline.vim index 0a0594d63d..3c6dd6bc85 100644 --- a/test/old/testdir/test_modeline.vim +++ b/test/old/testdir/test_modeline.vim @@ -559,18 +559,4 @@ func Test_modeline_nowrap_lcs_extends() set equalalways& endfunc -" Verify that backticks in 'path' set from a modeline are not executed -func Test_path_modeline() - let lines =<< trim END - // vim: set path+=foobar : - END - call writefile(lines, 'Xpoc.c', 'D') - - set nomodelinestrict modeline - call assert_fails('split Xpoc.c', 'E520:') - - bwipe! - set modelinestrict& modeline& -endfunc - " vim: shiftwidth=2 sts=2 expandtab