Wednesday, February 16, 2022

Re: Vim9 - Can not get compile to recognize a deep variable

Ben,

Thanks for pinpoint information. I read that section earlier today and
overlooked the Global in that sentence.

Like 'var udp: list<string>', it would be nice to declare the global equivalent
'g:udp: list<any>' (redundant, but reminds me what Vim is expecting when I look
at the code).

Thanks again,
Samson

--
--
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/20220216225704.00006f2d%40cfl.rr.com.

Re: Vim9 - Can not get compile to recognize a deep variable

Samson,

global, buffer, window and tabpage variables do not have a specific type. This
is explained under ":help variable-types".

Ben


On 2022-02-16, Chainsaw wrote:
> Bram,
>
> First, thank you for Vim. What you have created is amazing, and has literally
> filled every void I had in my workflow, from text editing, to writing software
> to streamline specific tasks, and infinitely more. The only thing I don't like
> is I use Vim so much, that I find myself typing a ':' everywhere, on desktop,
> in title bar of browser, and I tried to save a file today in Word by typing ':w'.
>
> I put the 'udp' declaration outside of the function and made global. That worked,
> thank you. However, the declaration 'g:udp: list<string>' gives an E488 error.
> So, I tried 'g:udp = []' and that worked. Can you please explain the proper way
> to declare the list globally, because I thought the first way was correct.
>
> Thank you,
> Samson
>
>
>
>
> --
> --
> 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/20220216182719.00003249%40cfl.rr.com.

--
--
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/Yg23RpVhCFouvrU/%40laptop.homenetwork.

Re: Vim9 - Can not get compile to recognize a deep variable

Bram,

First, thank you for Vim. What you have created is amazing, and has literally
filled every void I had in my workflow, from text editing, to writing software
to streamline specific tasks, and infinitely more. The only thing I don't like
is I use Vim so much, that I find myself typing a ':' everywhere, on desktop,
in title bar of browser, and I tried to save a file today in Word by typing ':w'.

I put the 'udp' declaration outside of the function and made global. That worked,
thank you. However, the declaration 'g:udp: list<string>' gives an E488 error.
So, I tried 'g:udp = []' and that worked. Can you please explain the proper way
to declare the list globally, because I thought the first way was correct.

Thank you,
Samson




--
--
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/20220216182719.00003249%40cfl.rr.com.

Re: Vim9 - Can not get compile to recognize a deep variable

> 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

This happens because when compiling the function, when the :substitute
command is separate, the compiler recognizes the "\=" in the
substitution. Then it works.

When joining the two lines the compiler only sees the ":global" command
and doesn't check for the "\=" argument.

This is nearly impossible to fix, because parsing the ":global" command
requires parsing just about any Ex command. That can only be done at
runtime, and then the local variable is not visible.

You'll have to use a workaround. You could make the "udp" variable a
global. That is what would happen in legacy script as well.

--
ERROR 047: Keyboard not found. Press RETURN to continue.

/// 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/20220216221529.BD9C41C0FE0%40moolenaar.net.

Vim9 - Can not get compile to recognize a deep variable

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.

Tuesday, February 15, 2022

Re: [VIM] Re: [VIM] Re: [VIM] Re: [VIM] Re: vim/colorschemes: Request For Comments

I have changed the name to those you suggest:

/home/cazzola/.vim/pack/bundle/start
└── colorschemes
├── colors
│   ├── blue.vim
│   ├── darkblue.vim
│   ├── delek.vim
│   ├── desert.vim
│   ├── elflord.vim
│   ├── evening.vim
│   ├── industry.vim
│   ├── koehler.vim
│   ├── morning.vim
│   ├── murphy.vim
│   ├── pablo.vim
│   ├── peachpuff.vim
│   ├── README.txt
│   ├── ron.vim
│   ├── shine.vim
│   ├── slate.vim
│   ├── tools
│   │   ├── check_colors.vim
│   │   ├── sample_base.vim
│   │   ├── sample_diff.vim
│   │   ├── sample_messages.vim
│   │   └── sample_popupmenu.vim
│   ├── torte.vim
│   └── zellner.vim
├── colortemplate
│   ├── blue.colortemplate
│   ├── darkblue.colortemplate
│   ├── delek.colortemplate
│   ├── desert.colortemplate
│   ├── _diff
│   ├── elflord.colortemplate
│   ├── evening.colortemplate
│   ├── industry.colortemplate
│   ├── koehler.colortemplate
│   ├── morning.colortemplate
│   ├── murphy.colortemplate
│   ├── pablo.colortemplate
│   ├── peachpuff.colortemplate
│   ├── ron.colortemplate
│   ├── shine.colortemplate
│   ├── slate.colortemplate
│   ├── _tcozero
│   ├── torte.colortemplate
│   └── zellner.colortemplate
└── README.md

but the final result doesn't change:

:verbose hi Normal
Normal xxx ctermfg=121 ctermbg=0 guifg=lightgreen guibg=Black
Last set from /usr/share/vim/vim82/colors/murphy.vim line 14

Walter

On Tue, 15 Feb 2022, Maxim Kim wrote:

>
>
> вторник, 15 февраля 2022 г. в 13:44:16 UTC+3, Walter Cazzola:
>
>> As replied to Romain, also the manual installation fails.
>>
>
> The directory structure I see is not what `:h packages` would suggest to
> have.
>
> In the end it should have smth like:
>
> /home/username/.vim/pack/bundle/start
> └── colorschemes
> ├── README.md
> ├── colors
> │·· ├── README.txt
> │·· ├── blue.vim
> │·· ├── darkblue.vim
> │·· ├── delek.vim
> │·· ├── desert.vim
> │·· ├── elflord.vim
> │·· ├── evening.vim
> │·· ├── industry.vim
> │·· ├── koehler.vim
> │·· ├── morning.vim
> │·· ├── murphy.vim
> │·· ├── pablo.vim
> │·· ├── peachpuff.vim
> │·· ├── ron.vim
> │·· ├── shine.vim
> │·· ├── slate.vim
> │·· ├── tools
> │·· │·· ├── check_colors.vim
> │·· │·· ├── sample_base.vim
> │·· │·· ├── sample_diff.vim
> │·· │·· ├── sample_messages.vim
> │·· │·· └── sample_popupmenu.vim
> │·· ├── torte.vim
> │·· └── zellner.vim
> ├── colortemplate
> │·· ├── _diff
> │·· ├── _tcozero
> │·· ├── blue.colortemplate
> │·· ├── darkblue.colortemplate
> │·· ├── delek.colortemplate
> │·· ├── desert.colortemplate
> │·· ├── elflord.colortemplate
> │·· ├── evening.colortemplate
> │·· ├── industry.colortemplate
> │·· ├── koehler.colortemplate
> │·· ├── morning.colortemplate
> │·· ├── murphy.colortemplate
> │·· ├── pablo.colortemplate
> │·· ├── peachpuff.colortemplate
> │·· ├── ron.colortemplate
> │·· ├── shine.colortemplate
> │·· ├── slate.colortemplate
> │·· ├── torte.colortemplate
> │·· └── zellner.colortemplate
> └── tags
>
>

--
Walter Cazzola, PhD, Associate Professor, Computer Science, Univ. of Milano
cazzola@di.unimi.it @w_cazzola Ph: +39 02 503 16300 HP: cazzola.di.unimi.it
· · · ---------------------------- · · · ---------------------------- · · ·
... recursive: adjective, see recursive ...
· · · ---------------------------- · · · ---------------------------- · · ·

--
--
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/a066444c-90e0-427f-bc97-fdf1cbb7981c%40di.unimi.it.

Re: [VIM] Re: [VIM] Re: [VIM] Re: vim/colorschemes: Request For Comments



вторник, 15 февраля 2022 г. в 13:44:16 UTC+3, Walter Cazzola:
As replied to Romain, also the manual installation fails.

The directory structure I see is not what `:h packages` would suggest to have.

In the end it should have smth like:

/home/username/.vim/pack/bundle/start
└── colorschemes
    ├── README.md
    ├── colors
    │·· ├── README.txt
    │·· ├── blue.vim
    │·· ├── darkblue.vim
    │·· ├── delek.vim
    │·· ├── desert.vim
    │·· ├── elflord.vim
    │·· ├── evening.vim
    │·· ├── industry.vim
    │·· ├── koehler.vim
    │·· ├── morning.vim
    │·· ├── murphy.vim
    │·· ├── pablo.vim
    │·· ├── peachpuff.vim
    │·· ├── ron.vim
    │·· ├── shine.vim
    │·· ├── slate.vim
    │·· ├── tools
    │·· │·· ├── check_colors.vim
    │·· │·· ├── sample_base.vim
    │·· │·· ├── sample_diff.vim
    │·· │·· ├── sample_messages.vim
    │·· │·· └── sample_popupmenu.vim
    │·· ├── torte.vim
    │·· └── zellner.vim
    ├── colortemplate
    │·· ├── _diff
    │·· ├── _tcozero
    │·· ├── blue.colortemplate
    │·· ├── darkblue.colortemplate
    │·· ├── delek.colortemplate
    │·· ├── desert.colortemplate
    │·· ├── elflord.colortemplate
    │·· ├── evening.colortemplate
    │·· ├── industry.colortemplate
    │·· ├── koehler.colortemplate
    │·· ├── morning.colortemplate
    │·· ├── murphy.colortemplate
    │·· ├── pablo.colortemplate
    │·· ├── peachpuff.colortemplate
    │·· ├── ron.colortemplate
    │·· ├── shine.colortemplate
    │·· ├── slate.colortemplate
    │·· ├── torte.colortemplate
    │·· └── zellner.colortemplate
    └── tags

--
--
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/ae16b47e-27a4-47a3-ad1f-6dff9b640d4en%40googlegroups.com.