Wednesday, April 10, 2013

Re: unlet-ing variables in buffers?

Hi LCD!

On Mi, 10 Apr 2013, LCD 47 wrote:

> Variables local to (non-current) buffers can be read with
> getbufvar() and written with setbufvar(). Is there a way to delete
> variables from buffers? That is, is there a moral equivalent of
> "unlet b:var" for non-current buffers?

I think, since you only get references to variables when using
getbufvar() you can simply modify the returned b: dict

:call setbufvar(1, 'foobar', 2)
:let var=getbufvar(1, '')
:call filter(var, 'v:key != ''foobar''')
:echo getbufvar(1, 'foobar')

regards,
Christian
--
Betrug: die Triebkraft des Geschäfts, die Seele der Religion, der
Köder der Liebeswerbung und die Grundlage politischer Macht.
-- Ambrose Gwinnet Bierce (Des Teufels Wörterbuch)

--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: