1+ if has (' nvim' )
2+ function ! s: report_error (msg, ... ) abort
3+ if a: 0 == # 0
4+ call v: lua .vim .health.error (a: msg )
5+ else
6+ call v: lua .vim .health.error (a: msg , a: 1 )
7+ endif
8+ endfunction
9+ function ! s: report_warn (msg, note) abort
10+ call v: lua .vim .health.warn (a: msg , a: note )
11+ endfunction
12+ function ! s: report_ok (msg) abort
13+ call v: lua .vim .health.ok (a: msg )
14+ endfunction
15+ else
16+ function ! s: report_error (msg) abort
17+ call health#report_error (a: msg )
18+ endfunction
19+ function ! s: report_warn (msg, note) abort
20+ call health#report_warn (a: msg , a: note )
21+ endfunction
22+ function ! s: report_ok (msg) abort
23+ call health#report_ok (a: msg )
24+ endfunction
25+ endif
26+
127function ! s: check_job () abort
228 if ! has (' nvim' ) && ! has (' job' )
3- call health# report_error (' Not supported since +job feature is not enabled' )
29+ call s: report_error (' Not supported since +job feature is not enabled' )
430 else
5- call v: lua . vim .health. ok (' +job is available to execute Git command' )
31+ call s: report_ok (' +job is available to execute Git command' )
632 endif
733endfunction
834
@@ -12,7 +38,7 @@ function! s:check_floating_window() abort
1238 endif
1339
1440 if ! exists (' *nvim_win_set_config' )
15- call v: lua . vim .health. warn (
41+ call s: report_warn (
1642 \ ' Neovim 0.3.0 or earlier does not support floating window feature. Preview window is used instead' ,
1743 \ ' Please install Neovim 0.4.0 or later' )
1844 return
@@ -29,7 +55,7 @@ function! s:check_floating_window() abort
2955 \ })
3056 noautocmd call nvim_win_close (win_id, v: true )
3157 catch /^Vim\%((\a\+)\)\=:E118/
32- call v: lua . vim .health. error (
58+ call s: report_error (
3359 \ ' Your Neovim is too old' ,
3460 \ [
3561 \ ' Please update Neovim to 0.4.0 or later' ,
@@ -38,23 +64,23 @@ function! s:check_floating_window() abort
3864 return
3965 endtry
4066
41- call v: lua . vim .health. ok (' Floating window is available for popup window' )
67+ call s: report_ok (' Floating window is available for popup window' )
4268endfunction
4369
4470function ! s: check_git_binary () abort
4571 let cmd = get (g: , ' git_messenger_git_command' , ' git' )
4672 if ! executable (cmd)
47- call v: lua . vim .health. error (' `' . cmd . ' ` command is not found. Please set proper command to g:git_messenger_git_command' )
73+ call s: report_error (' `' . cmd . ' ` command is not found. Please set proper command to g:git_messenger_git_command' )
4874 return
4975 endif
5076
5177 let output = substitute (system (cmd . ' -C . --version' ), ' \r\=\n' , ' ' , ' g' )
5278 if v: shell_error
53- call v: lua . vim .health. error (' Git command `' . cmd . ' ` is broken (v1.8.5 or later is required): ' . output)
79+ call s: report_error (' Git command `' . cmd . ' ` is broken (v1.8.5 or later is required): ' . output)
5480 return
5581 endif
5682
57- call v: lua . vim .health. ok (' Git command `' . cmd . ' ` is available: ' . output)
83+ call s: report_ok (' Git command `' . cmd . ' ` is available: ' . output)
5884endfunction
5985
6086function ! s: check_vim_version () abort
@@ -63,13 +89,13 @@ function! s:check_vim_version() abort
6389 endif
6490
6591 if v: version < 800
66- call health# report_error (
92+ call s: report_error (
6793 \ ' Your Vim version is too old: ' . v: version ,
6894 \ ' Please install Vim 8.0 or later' )
6995 return
7096 endif
7197
72- call health# report_error (' Vim version is fine: ' . v: version )
98+ call s: report_error (' Vim version is fine: ' . v: version )
7399endfunction
74100
75101function ! health#gitmessenger#check () abort
0 commit comments