Friday, February 16, 2018

recursive command call

Hi,


With this XPATH command, would like to give to user proposal list from helper#XpathList(A,L,P) func and recall helper#XpathList(A,L,P) with the list's word selected by user (out of calling edit<bang>).

Is it possible ?


Thank you




fun! helper#XpathList(A,L,P) "{{{

ruby << EOF

require 'ox'
require 'open-uri'

# 0. on one xml file
xmlpath = ENV['tmp']+"/localConf.xml"
doc = Ox.parse(open(xmlpath).read)

# 1. client search string node nam"
searched_node = 'RESSOURCE'

# 2. retrieve all sorted child possible elements'name
arr = doc.root.locate('*/' + searched_node)

arr_out = {}
arr.each { |a|
a.each {|key, value|
arr_out[key.value]=""
}
}

# arr_out = ['this', 'is', 'it!', 'Through ruby code', 'this is it !']
# 3.
Vim::command("return " + arr_out.keys().to_s )

EOF
endfunction "}}} :
command! -nargs=1 -bang -complete=customlist,helper#XpathList
\ XPATH edit<bang> <args>


--
--
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: