2017-06-11 18:36 GMT+03:00 Ni Va <nivaem...@gmail.com>: > 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()` in `index()` is not needed. And I am unable to reproduce your problem (vim 8.0.582), maybe need a specific set of options or specific file contents: using file created with `writefile(range(10), '/tmp/filename')` for the test. Wondering whether you understand that without the context (is this placed in a function?) `g:file` and `file` are the same variables? (Inside a function `file` would be `l:file`.) Though based on my knowledge of VimL this should not matter in this code: `file` will be reassigned only after expression evaluation finishes. > > > Thank you > > > -- > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.