Re: Help converting function to Vim9 script

2021-07-04 Thread Bram Moolenaar
> >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

Re: Help converting function to Vim9 script

2021-07-04 Thread Steve Litt
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

Re: Help converting function to Vim9 script

2021-07-04 Thread Bram Moolenaar
> The MetaPost plugin in Vim contains the following definition to replace > the n-th occurrence of `beginfig(...)` with `beginfig(n)`: > > function! s:fix_beginfigs() > let i = 1 > g/^beginfig(\d*);$/s//\='beginfig('.i.');'/ | let i = i + 1 > endfunction > > command

Re: Pre-fold output of :r! command

2021-07-04 Thread 'Suresh Govindachar' via vim_use
On 7/4/2021 1:08 PM, Julius Hamilton wrote: I would like to print the output of a shell command - a webpage dump - into a Vim buffer, and have those lines immediately folded, rather than a second step of selecting and folding them. The command would look something like: :r! w3m -dump url.com

Pre-fold output of :r! command

2021-07-04 Thread Julius Hamilton
I would like to print the output of a shell command - a webpage dump - into a Vim buffer, and have those lines immediately folded, rather than a second step of selecting and folding them. The command would look something like: :r! w3m -dump url.com FOLD How would this be possible? I would like

Help converting function to Vim9 script

2021-07-04 Thread Lifepillar
The MetaPost plugin in Vim contains the following definition to replace the n-th occurrence of `beginfig(...)` with `beginfig(n)`: function! s:fix_beginfigs() let i = 1 g/^beginfig(\d*);$/s//\='beginfig('.i.');'/ | let i = i + 1 endfunction command -nargs=0 FixBeginfigs