Thursday, April 5, 2018

calling vimscript in background in current VIM instance

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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment