Friday, June 4, 2021

Re: Error in Ruby code embedded in vim9script

Ok, Can I code legacy function in a vim9script just for this case and keep all rest with def function ?

Thank you Bram

Le jeudi 3 juin 2021 à 21:56:57 UTC+2, Bram Moolenaar a écrit :

Ni Va wrote:

> This is in my _vimrc
> nnoremap <F6> :exe '!start '.expand('$vimruntime/gvim.exe').' -c
> "call readxml\#mainruby()"'<cr>
>
>
> Under this dir vimfiles\plugged\readxml\autoload this code is in a script
> called readxml.vim
> vim9script
> # MIT License. Copyright (c) 2021 June 02 Niva.
>
> # Ruby code section
> def readxml#mainruby()
> call s:rubyCaller()
> enddef
>
> def s:rubyCaller()
>
> #https://ruby-doc.org/core-3.0.0/
> #http://www.ohler.com/ox/#label-Object+Dump+Sample-3A
>
> ruby << EOF
>
> # Core
> $LOAD_PATH << Vim::evaluate('expand("$vim/extensions/ruby/lib/ruby/3.0.0")')
> EOF
> enddef
>
>
> Use Case : then I type <F6>

OK, using "ruby << EOF", aka heredoc, in a :def function is not
supported yet. You can use a legacy function for now.

--
A programmer's wife asks him: "Please run to the store and pick up a loaf of
bread. If they have eggs, get a dozen". The programmer comes home with 12
loafs of bread.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/33094384-546f-400d-837a-d9e8a56d4efan%40googlegroups.com.

No comments: