0
0
mirror of https://github.com/vim/vim.git synced 2025-10-05 05:34:07 -04:00

patch 8.2.2228: Vim9: cannot use ":e #" because # starts a comment

Problem:    Vim9: cannot use ":e #" because # starts a comment.
Solution:   Support using %% instead of #.
This commit is contained in:
Bram Moolenaar
2020-12-27 16:55:11 +01:00
parent e462f52db3
commit 4389f9cd00
3 changed files with 91 additions and 31 deletions

View File

@@ -25,6 +25,53 @@ def Test_edit_wildcards()
CheckDefFailure(['edit `="foo"'], 'E1083:')
enddef
def Test_expand_alternate_file()
var lines =<< trim END
edit Xfileone
var bone = bufnr()
edit Xfiletwo
var btwo = bufnr()
edit Xfilethree
var bthree = bufnr()
edit #
assert_equal(bthree, bufnr())
edit %%
assert_equal(btwo, bufnr())
edit %% # comment
assert_equal(bthree, bufnr())
edit %%yy
assert_equal('Xfiletwoyy', bufname())
exe "edit %%" .. bone
assert_equal(bone, bufnr())
exe "edit %%" .. btwo .. "xx"
assert_equal('Xfiletwoxx', bufname())
next Xfileone Xfiletwo Xfilethree
assert_equal('Xfileone', argv(0))
assert_equal('Xfiletwo', argv(1))
assert_equal('Xfilethree', argv(2))
next %%%zz
assert_equal('Xfileone', argv(0))
assert_equal('Xfiletwo', argv(1))
assert_equal('Xfilethreezz', argv(2))
v:oldfiles = ['Xonefile', 'Xtwofile']
edit %%<1
assert_equal('Xonefile', bufname())
edit %%<2
assert_equal('Xtwofile', bufname())
assert_fails('edit %%<3', 'E684:')
edit Xfileone.vim
edit Xfiletwo
edit %%:r
assert_equal('Xfileone', bufname())
END
CheckDefAndScriptSuccess(lines)
enddef
def Test_global_backtick_expansion()
new
setline(1, 'xx')