Sunday, July 4, 2021

Re: Help converting function to Vim9 script

Bram Moolenaar said on Sun, 04 Jul 2021 23:30:01 +0200


>Well, this works:
>
>def Fix_beginfigs()
> g:index = 1
> g/^beginfig(\d*);$/s//\='beginfig(' .. g:index .. ');'/ | g:index =
> g:index + 1 unlet g:index
>enddef
>
>However, using a legacy function would not be worse. The global
>command does most of the work, what function it's in doesn't really
>matter.

Hi Bram,

I try not to use global variables within functions. Is there an
alternative enabling non-use of global variables?

Also, I thought the new Vim9 Vimscript was getting rid of the need for
g: and l: and a: etc. That stuff used to kill my brain.

Thanks,

SteveT

Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques

--
--
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/20210704175218.0c12e4dc%40mydesk.domain.cxm.

No comments: