Hello,
I have read through the Vim9.txt, and can not find a solution to this issue.
When I call Parse(), the script version with the entire command on one line (|) gives error 'E121: Undefined variable: udp' in function add().
Both commands work if used on the command line, so its particular to running in a Vim9 script.
This works:
def g:Parse(): void
var udp: list<string>
:3global/^\s*<per/substitute/^\s*<per\(.\{-}"\)\{2}\|\s\+>.*$//g
:3substitute/\s\+.\{-}"\zs.\{-}\ze"/\=add(udp, submatch(0))/gn
# :3global/^\s*<per/substitute/^\s*<per\(.\{-}"\)\{2}\|\s\+>.*$//g
# | substitute/\s\+.\{-}"\zs.\{-}\ze"/\=add(udp, submatch(0))/gn
echo udp
enddef
This does not work:
def g:Parse(): void
var udp: list<string>
# :3global/^\s*<per/substitute/^\s*<per\(.\{-}"\)\{2}\|\s\+>.*$//g
# :3substitute/\s\+.\{-}"\zs.\{-}\ze"/\=add(udp, submatch(0))/gn
:3global/^\s*<per/substitute/^\s*<per\(.\{-}"\)\{2}\|\s\+>.*$//g
| substitute/\s\+.\{-}"\zs.\{-}\ze"/\=add(udp, submatch(0))/gn
echo udp
enddef
Thanks,
Chainsaw
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220216115616.00007429%40cfl.rr.com.
No comments:
Post a Comment