mapping list with : v:val and index of v:val

2017-06-11 Thread Ni Va
Hi, Trying this let file = readfile(expand("%:p"),'b') let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. Thank you -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply bel

Re: mapping list with : v:val and index of v:val

2017-06-11 Thread Nikolay Aleksandrovich Pavlov
2017-06-11 18:36 GMT+03:00 Ni Va : > Hi, > > Trying this > > > let file = readfile(expand("%:p"),'b') > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. There is `v:key`, do not use `index()` here; and using `copy()`

Re: mapping list with : v:val and index of v:val

2017-06-11 Thread Bram Moolenaar
Ni Va wrote: > Trying this > > > let file = readfile(expand("%:p"),'b') > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. Works fine for me (spaces added for readability): let file = ['aaa', 'bbb', 'cc

Re: mapping list with : v:val and index of v:val

2017-06-11 Thread Ni Va
Le dimanche 11 juin 2017 18:35:59 UTC+2, Bram Moolenaar a écrit : > Ni Va wrote: > > > Trying this > > > > > > let file = readfile(expand("%:p"),'b') > > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. > > W

Re: mapping list with : v:val and index of v:val

2017-06-11 Thread Ni Va
Le dimanche 11 juin 2017 18:35:59 UTC+2, Bram Moolenaar a écrit : > Ni Va wrote: > > > Trying this > > > > > > let file = readfile(expand("%:p"),'b') > > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. > > W

Re: mapping list with : v:val and index of v:val

2017-06-11 Thread Ni Va
Le dimanche 11 juin 2017 20:09:19 UTC+2, Ni Va a écrit : > Le dimanche 11 juin 2017 18:35:59 UTC+2, Bram Moolenaar a écrit : > > Ni Va wrote: > > > > > Trying this > > > > > > > > > let file = readfile(expand("%:p"),'b') > > > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > >