After reading a file and getting 1 million lines' List, I need to make similar 
substitutions over matched lines ~500 times with this func:

fun! foo#set_new_val(ressource) abort "{{{

  " position
  let pos  = foo#getpos_ress(a:ressource)
  let pres = foo#geth_presence(a:ressource)
  let s:xml[pos] = substitute(s:xml[pos],'false\|true',pres,"")  <<< HERE

  " Slave/Voie01 to Voie08
  for idx in [1,2,3,4,5,6,7,8]       <<< HERE
        let pos = foo#getpos_ress(a:ressource.'/bar0'.string(idx))
        let s:xml[pos] = substitute(s:xml[pos],'false\|true',pres,"")    <<< 


1/ Can I optimize this function ?
2/ Maybe mapping this line code in register : 
substitute(s:xml[pos],'false\|true',pres,"") ?

Thank you

Nota : General Concept

0. Dicts
   0.1 Reading file to List (1 million lines)
   0.2 Dict with new values to set onto matched lines
   0.3 Memory DictPos of List's lines numbers (0.1) matching needed lines.

1. Process List into for loop of 500
   1.1 Do matchstrpos to get line's position to update in List (foo#getpos_ress)
   1.2 Make substitution as describe above. 

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.

Reply via email to