droptheplot / abcgo

ABC metrics for Go source code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vim plugin failing with "Unknown function: job_start"

opened this issue · comments

  1. Starting with nvim & OSX
  2. Installed plugin with vim-plug; vim-plug reported success
  3. Open .go file
  4. nvim reports:
Error detected while processing function ABCGo:
line    1:
E117: Unknown function: job_start

It appears this ticket may be relevant.

I am not a vimscript hacker, but this code change seems to fix the issue:

diff --git a/vim/plugin/abcgo.vim b/vim/plugin/abcgo.vim
index 839fda4..36f68ba 100644
--- a/vim/plugin/abcgo.vim
+++ b/vim/plugin/abcgo.vim
@@ -33,7 +33,11 @@ function! ABCGoBackground(channel, reports)
 endfunction

 function! ABCGo()
-  call job_start($GOPATH . "/bin/abcgo -format raw -path " . expand("%:p"), {'callback': 'ABCGoBackground', 'mode': 'raw'})
+  if has("nvim")
+    call jobstart($GOPATH . "/bin/abcgo -format raw -path " . expand("%:p"), {'callback': 'ABCGoBackground', 'mode': 'raw'})
+  else
+    call job_start($GOPATH . "/bin/abcgo -format raw -path " . expand("%:p"), {'callback': 'ABCGoBackground', 'mode': 'raw'})
+  endif
 endfunction

 augroup abcgo_autocmd

Hi @serussell,
Thank you for the issue! I didn't test it with NeoVim but looks like you're right, Vim has job_start() and NeoVim jobstart(). I'll try NeoVim and fix it soon.