calling vimscript in background in current VIM instance

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

calling vimscript in background in current VIM instance

Ni Va
Hi,

I would like to make Vim's current instance be able to monitor itself.

1. On VimEnter, autocmd launch main entry
2. main tries to job_start gvim executable that launch the monitoring func but it fails

Why ?

Thank you
NiVa


This is the autoload/foo.vim code:

let s:vimexe  = fnamemodify($vimruntime.'/gvim.exe',':p:h:gs?/?\\?')
let s:startmonitoring = "Start Timer to Autokill"

fun! autokill#main() "{{{
        echomsg s:startmonitoring
        echomsg job_start(s:startmonitoring.' -c "call autokill#monitoring()"')
endfunc "}}}
fun! autokill#monitoring() "{{{
        if g:autokill
                echomsg "End Monitoring : Kill"
        else
                echomsg "Monitoring, alive..."
        endif
endfunc "}}}



This is plugin/foo.vim :


au FocusLost   * let g:autokill = 1
au FocusGained * let g:autokill = 0
au VimEnter * call autokill#main()    

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: calling vimscript in background in current VIM instance

Christian Brabandt

On Do, 05 Apr 2018, Ni Va wrote:

> Hi,
>
> I would like to make Vim's current instance be able to monitor itself.
>
> 1. On VimEnter, autocmd launch main entry
> 2. main tries to job_start gvim executable that launch the monitoring func but it fails
>
> Why ?
>
> Thank you
> NiVa
>
>
> This is the autoload/foo.vim code:
>
> let s:vimexe  = fnamemodify($vimruntime.'/gvim.exe',':p:h:gs?/?\\?')
> let s:startmonitoring = "Start Timer to Autokill"
>
> fun! autokill#main() "{{{
> echomsg s:startmonitoring
> echomsg job_start(s:startmonitoring.' -c "call autokill#monitoring()"')

You are trying to start `Start Timer to Autokill`. That does not make
any sense. use v:progpath or v:progname

Best,
Christian
--
Man muß die Zukunft im Sinn haben und die Vergangenheit in den Akten.
                -- Charles Maurice de Talleyrand

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.