Hi,
> Hi,
>
> I would like to make values become keys in this dict, is it possible
> in one simple command ?
>
> let mydict={'"':'"', '&':'&', ''':"'", '<':'<'}
For instance,
:echo map(copy(mydict), '{v:val : v:key}')
doesn't permit to build a new dictionary from scratch
However, with a dirty hack, it becomes possible to do this with a almost-oneliner:
:let d2 = {}
:call map(copy(mydict), 'extend(d2, {v:val : v:key})')
:echo d2
HTH,
--
Luc Hermitte
--
--
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/d/optout.
No comments:
Post a Comment