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)')
> > > 
> > > 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', 'ccc']
> > 	echo map(copy(file), 'v:val . ":" . index(copy(file), v:val)')
> > 
> > 	['aaa:0', 'bbb:1', 'ccc:2']
> > 
> > 
> > -- 
> > I am also told that there is a logical proof out there somewhere
> > that demonstrates that there is no task which duct tape cannot handle.
> > 					-- Paul Brannan
> > 
> >  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
> > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
> >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
> 
> Reproduce it with a list made of 150000 lines of a file. 
> 
> But effectively I have to use v:key. 
> Thank you for all.
Ok works fine with v:key.
let file = readfile(expand("%:p"),'b')
call map(file,'v:val.":".v:key')
nota : g:file was just to put=g:file result in my buffer to see the result.
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment