2018-02-11 2:24 GMT+03:00 Ni Va <[email protected]>:
> Le dimanche 11 février 2018 00:01:30 UTC+1, ZyX a écrit :
>> 2018-02-11 1:58 GMT+03:00 Ni Va <[email protected]>:
>> > Le samedi 10 février 2018 21:17:16 UTC+1, Tony Mechelynck a écrit :
>> >> On Sat, Feb 10, 2018 at 7:29 PM, 'Andy Wokula' via vim_use
>> >> <[email protected]> wrote:
>> >> > Am 10.02.2018 um 17:40 schrieb Ni Va:
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> Like :h ruby says, I use this kind of script ruby interface below.
>> >> >>
>> >> >> How can i make vim switch automatically to ruby syntax in EOF section 
>> >> >> and
>> >> >> rest of time stay in vim syntax ?
>> >> >> Thank you
>> >> >>
>> >> >>
>> >> >> Example Vim script: >
>> >> >>
>> >> >>         function! RedGem()
>> >> >>         ruby << EOF
>> >> >>         class Garnet
>> >> >>                 def initialize(s)
>> >> >>                         @buffer = Vim::Buffer.current
>> >> >>                         vimputs(s)
>> >> >>                 end
>> >> >>                 def vimputs(s)
>> >> >>                         @buffer.append(@buffer.count,s)
>> >> >>                 end
>> >> >>         end
>> >> >>         gem = Garnet.new("pretty")
>> >> >>         EOF
>> >> >>         endfunction
>> >> >
>> >> >
>> >> > Configurable:
>> >> >     :h ft-vim-syntax
>> >> >
>> >> > --
>> >> > Andy
>> >>
>> >> Under :h g:vimsyn_embed it says: «By default, g:vimsyn_embed is a
>> >> string supporting interpreters that your vim itself supports.»
>> >> However, my gvim is compiled with +lua -mzscheme +perl +python
>> >> -python3 +ruby +tcl, and I don't set that variable in my vimrc (or
>> >> anywhere else AFAIK), yet it is set to 'lmpPr' as if I had compiled
>> >> with +mzscheme -tcl. How come?
>> >>
>> >> N.B. The same value is set if I run "view -u
>> >> /usr/local/share/vim/vim80/vimrc_example.vim ~/.vimrc" i.e. _viewing_
>> >> my vimrc (so that the vim ftplugin gets sourced) but not _sourcing_
>> >> it.
>> >>
>> >> Best regards,
>> >> Tony.
>> >
>> > Hi Tony,
>> >
>> > My version has all supports lua/python/ruby but meanwhile setting let 
>> > g:vimsyn_embed = 'r' in _vimrc it appears that not working because of 
>> > s:rubypath undefined as is in vim80/syntax.vim:
>> >
>> > let s:rubypath= fnameescape(expand("<sfile>:p:h")."/ruby.vim")
>> > if !filereadable(s:rubypath)
>> >  for s:rubypath in split(globpath(&rtp,"syntax/ruby.vim"),"\n")
>> >   if filereadable(fnameescape(s:rubypath))
>> >    let s:rubypath= fnameescape(s:rubypath)
>> >    break
>> >   endif
>> >  endfor
>> > endif
>> > if (g:vimsyn_embed =~# 'r' && has("ruby")) && filereadable(s:rubypath)
>> >
>> >
>> >
>> > expand("<sfile>:p:h") <<< returns nothing.
>>
>> How are you checking this? Using `<sfile>` makes no sense anywhere,
>> but in a script file. Note: anywhere includes functions defined in a
>> script file. Check `:h <sfile>`.
>>
>> >
>> > Thank you
>> >
>> > --
>> > --
>> > You received this message from the "vim_dev" 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_dev" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to [email protected].
>> > For more options, visit https://groups.google.com/d/optout.
>
> Cursor In this function below, I test that :
> let ret=expand('<sfile>') | echo '<'.string(ret).'>'
> it returns <''>

Where? I do not see this line in a function below and as I said it
does not make sense in a function (though it should neither return
empty string, when called from a function this is expected to yield
stack trace). If you said that you place cursor onto the function
while editing and run that from command-line then this is exactly what
I said about places where `<sfile>` makes no sense.

If you want to check what `<sfile>` returns do edit the file where you
see it and never run it yourself directly.

>
> fun! helper#Ox_DOM_ParsingXml() "{{{
> ruby << EOF
>
> # Check out Ox's tests to see how to iterate through it: 
> https://github.com/ohler55/ox/blob/master/test/parse_cmp.rb
>
> require 'ox'
> require 'open-uri'
>
> doc = Ox.parse(open(ENV['tmp']+"/one.xml").read)
> p doc.root.locate('LISTE_VUES')
> endfunc
>
> --
> --
> You received this message from the "vim_dev" 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_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui