> How in vim9script a range should be processed by a def function?
>
> Vim9.txt states that def functions do not support range option.
>
> So given a range what def function would/should do? Run it for every line
> in range?
Normally the function will be called for each line in the range.
> How do I get smth similar to a:firstline and a:lastline?
You can pass a range as an argument. Or use marks.
Thus you can't do "1,10call Func()" and have the function called once
for the range. You can define a user command that takes the range and
passes it to the function.
You could also use a legacy function with the range option that calls
the :def function with a:firstline and a:lastine.
--
Facepalm statement #4: "3000 year old graves? That's not possible, it's only
2014!"
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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/20220111181454.C3EBB1C0573%40moolenaar.net.
No comments:
Post a Comment