Skip to content

Commit 945a441

Browse files
committed
Fix async detection on Vim 8 and newer
1 parent 8def67a commit 945a441

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

plugin/wakatime.vim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ let s:VERSION = '11.0.0'
6262
let s:heartbeats_buffer = []
6363
let s:send_buffer_seconds = 30 " seconds between sending buffered heartbeats
6464
let s:last_sent = localtime()
65-
let s:has_async = has('patch-7.4-2344') && exists('*job_start')
65+
let s:has_async_patch = has('patch-7.4-2344') || v:version >= 800
66+
let s:has_async = s:has_async_patch && exists('*job_start')
6667
let s:nvim_async = exists('*jobstart')
6768

6869
function! s:Init()
@@ -183,8 +184,8 @@ let s:VERSION = '11.0.0'
183184
elseif s:IsWindows()
184185
if s:is_debug_on
185186
let stdout = s:StripWhitespace(system('(' . s:JoinArgs(cmd) . ')'))
186-
if !empty(stdout)
187-
echo printf('[WakaTime] error installing wakatime-cli for Windows: %s\nWill retry using Vim built-in Python.', stdout)
187+
if !empty(stdout) && !stridx(stdout, 'wakatime-cli is up to date')
188+
echo printf("[WakaTime] error installing wakatime-cli for Windows:\n%s\n[WakaTime] Will retry using Vim built-in Python.", stdout)
188189
call s:InstallCLI(s:false)
189190
endif
190191
else
@@ -193,13 +194,13 @@ let s:VERSION = '11.0.0'
193194
else
194195
if s:is_debug_on
195196
let stdout = s:StripWhitespace(system(s:JoinArgs(cmd)))
196-
if !empty(stdout)
197-
echo printf('[WakaTime] error installing wakatime-cli: %s\nWill retry using Vim built-in Python.', stdout)
197+
if !empty(stdout) && !stridx(stdout, 'wakatime-cli is up to date')
198+
echo printf("[WakaTime] error installing wakatime-cli:\n%s\n[WakaTime] Will retry using Vim built-in Python.", stdout)
198199
call s:InstallCLI(s:false)
199200
endif
200201
else
201202
let stdout = s:StripWhitespace(system(s:JoinArgs(cmd) . ' &'))
202-
if !empty(stdout)
203+
if !empty(stdout) && !stridx(stdout, 'wakatime-cli is up to date')
203204
call s:InstallCLI(s:false)
204205
endif
205206
endif

0 commit comments

Comments
 (0)