This command works without errors:
:echo v:oldfiles->copy()->filter('v:val =~# "txt$"')
(see :h method
, :h v:oldfiles
, :h v:val
and :h =~#
)
I want to create a custom command / function combination that wraps the :echo
and still accepts the v:oldfiles->copy()->filter('v:val =~# "txt$"')
argument like in the :echo
did.
I have this:
command! -bar -complete=expression -nargs=1 Foo call FooFunc(<args>)
function! FooFunc(x)
echo a:x
endfunction
However, invoking :Foo v:oldfiles->copy()->filter('v:val =~# "txt$"')
results in the error:
E115: Missing quote: 'v:val =~#
How can I make it work like the :echo
?