Friday, June 25, 2021

Re: equivalent of get() for a string ?

Marc,

try this here:

if get(g:, 'purescript_update_path')
call PurescriptUpdatePath()
endif

You can omit the v:false in get(), see `:help get()` for more details.
g:, w: and b: return the global, window-local, and buffer-local dictionary,
respectively. See `:help g:` for more details. For example, if you run `:echo g:`
in the command-line it will print all the global variables as a dictionary. When
we pass g:, b: or w: to get(), we essentially use the following overload:
get({dict}, {key} [, {default}])


On 2021-06-24, Marc Chantreux wrote:
> hello people,
>
> I would like this
>
> if exists('g:purescript_update_path')
> if g:purescript_update_path
> call PurescriptUpdatePath()
> endif
> endif
>
> To be something like
>
> if get('g:purescript_update_path',v:false)
> call PurescriptUpdatePath()
> endif
>
> but get() doesn't work with strings and i don't find something close.
> did i miss something from the doc ?
>
> regards,
> marc
>
>
>
> --
> --
> 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/YNTfT1yVXYWRHawY%40prometheus.u-strasbg.fr.

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

No comments: