This is my dictionary:
vimvar = {'startline' : [ 'startline' , 'int(vim.eval("s:StartLine"))' ],
'startline-1' : [ 'startline' , 'int(vim.eval("s:StartLine"))-1'],
'endline' : [ 'endline' , 'int(vim.eval("s:EndLine"))' ],
'gcase' : [ 'gCASE' , 'vim.eval("g:CASE")' ],
'akeyw' : [ 'akeyw' , 'vim.eval("a:keyw")' ]
}
This is my checklist:
importlist = ['startline', 'gcase', 'akeyw']
What I want to do is to check if a value in importlist
is present as key in vimvar
dictionary.
If yes than:
The value of the 1st field in the sublist (associated with the key) must be a new global variable.
The value of the 2nd field in the sublist (associated with the key) must be executed. It imports a variable from my texteditor vim.
I created this code to realize above:
for n in importlist:
for key,val in vimvar.items():
if n in vimvar:
exec('global ' + vimvar[key][0])
exec(vimvar[val][0] + '=vimvar[val][1]')
But whatever I do it gives errors
undefined variable 'sa'
undefined variable 'gCASE', unhashable type list
etc
What did I wrong?