diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-12-03 08:17:38 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-12-03 08:35:13 +0800 |
| commit | 9671908c682dc3fc4e939f44a636457db6f3e5a4 (patch) | |
| tree | cc8180e5890f33950be616471ec521b0f08dc5a4 /src/nvim/testdir/test_gf.vim | |
| parent | 2ae0d32a72c3ee207b6f9cd48c4beffa6e7c774f (diff) | |
| download | rneovim-9671908c682dc3fc4e939f44a636457db6f3e5a4.tar.gz rneovim-9671908c682dc3fc4e939f44a636457db6f3e5a4.tar.bz2 rneovim-9671908c682dc3fc4e939f44a636457db6f3e5a4.zip | |
vim-patch:8.2.3900: it is not easy to use a script-local function for an option
Problem: It is not easy to use a script-local function for an option.
Solution: recognize s: and <SID> at the start of the expression. (Yegappan
Lakshmanan, closes vim/vim#9401)
https://github.com/vim/vim/commit/8bb65f230d3025037f34021a72616038da0601ee
Omit duplicate docs in fold.txt: removed in a later runtime update.
Cherry-pick test_diffmode.vim changes from patch 8.2.1432.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/testdir/test_gf.vim')
| -rw-r--r-- | src/nvim/testdir/test_gf.vim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index b2bb189688..e369645328 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -226,6 +226,32 @@ func Test_gf_includeexpr() delfunc IncFunc endfunc +" Test for using a script-local function for 'includeexpr' +func Test_includeexpr_scriptlocal_func() + func! s:IncludeFunc() + let g:IncludeFname = v:fname + return '' + endfunc + set includeexpr=s:IncludeFunc() + call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr) + new | only + call setline(1, 'TestFile1') + let g:IncludeFname = '' + call assert_fails('normal! gf', 'E447:') + call assert_equal('TestFile1', g:IncludeFname) + bw! + set includeexpr=<SID>IncludeFunc() + call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr) + new | only + call setline(1, 'TestFile2') + let g:IncludeFname = '' + call assert_fails('normal! gf', 'E447:') + call assert_equal('TestFile2', g:IncludeFname) + set includeexpr& + delfunc s:IncludeFunc + bw! +endfunc + " Check that expanding directories can handle more than 255 entries. func Test_gf_subdirs_wildcard() let cwd = getcwd() |