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)
Though wondering why syntax script has `&& has('ruby')` (still, I
remember complaining about that earlier) and `&& filereadable(…)`
nonsense: it will color valid commands as errors if there is no ruby
support set up (and \*.vim file may be intended for other then current
Vim versions) or if ruby syntax file is not present (and inability to
find syntax file does not mean that marking code in heredoc section as
*error* and not just Normal text is a good idea). This is in addition
to making Vim in some cases try finding and loading libraries even if
user explicitly expressed by an option that he does need some embedded
syntax and having workaround for hanging `has('tcl')` (a good hint to
not actually do this at all).
BTW, documentation does *not* say that embedded syntax will be
supported only if corresponding interpreters are supported, but it
does say that by default g:vimsyn_embed is set to a string supporting
interpreters which Vim supports (actually, it is set to a string
supporting interpreters syntax file supports minus tcl for some
reason).
>
>
>
> expand("<sfile>:p:h") <<< returns nothing.
>
> 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.
--
--
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.