2016-08-07 11:16:30 -07:00
|
|
|
*pi_health.txt* Healthcheck framework
|
2016-06-16 14:01:47 -07:00
|
|
|
|
|
|
|
Author: TJ DeVries <devries.timothyj@gmail.com>
|
|
|
|
|
2017-10-20 17:33:58 -07:00
|
|
|
Type |gO| to see the table of contents.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
|
|
|
==============================================================================
|
2017-10-15 11:31:12 -07:00
|
|
|
Introduction *health*
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
health.vim is a minimal framework to help with troubleshooting user
|
|
|
|
configuration. Nvim ships with healthchecks for configuration, performance,
|
|
|
|
python support, ruby support, clipboard support, and more.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
To run the healthchecks, use this command: >
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
:checkhealth
|
|
|
|
<
|
|
|
|
Plugin authors are encouraged to write new healthchecks. |health-dev|
|
2016-06-16 14:01:47 -07:00
|
|
|
|
|
|
|
==============================================================================
|
2017-10-15 11:31:12 -07:00
|
|
|
Commands *health-commands*
|
|
|
|
|
|
|
|
*:checkhealth* *:CheckHealth*
|
|
|
|
:checkhealth Run all healthchecks.
|
2017-10-15 14:23:17 -07:00
|
|
|
*E5009*
|
2017-11-10 14:37:54 -07:00
|
|
|
Nvim depends on |$VIMRUNTIME| and 'runtimepath' to find
|
|
|
|
the standard "runtime files" for syntax highlighting,
|
|
|
|
filetype-specific behavior, and standard plugins
|
|
|
|
(including :checkhealth). If the runtime files cannot
|
|
|
|
be found then those features will not work.
|
2017-10-15 11:31:12 -07:00
|
|
|
|
|
|
|
:checkhealth {plugins}
|
|
|
|
Run healthcheck(s) for one or more plugins. E.g. to run
|
2016-08-07 11:16:30 -07:00
|
|
|
only the standard Nvim healthcheck: >
|
2017-10-15 11:31:12 -07:00
|
|
|
:checkhealth nvim
|
2016-08-07 11:16:30 -07:00
|
|
|
< To run the healthchecks for the "foo" and "bar" plugins
|
|
|
|
(assuming these plugins are on your 'runtimepath' and
|
|
|
|
they have implemented health#foo#check() and
|
|
|
|
health#bar#check(), respectively): >
|
2017-10-15 11:31:12 -07:00
|
|
|
:checkhealth foo bar
|
2016-08-07 11:16:30 -07:00
|
|
|
<
|
2017-10-15 11:31:12 -07:00
|
|
|
==============================================================================
|
|
|
|
Functions *health-functions*
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2016-08-07 11:16:30 -07:00
|
|
|
health.vim functions are for creating new healthchecks. They mostly just do
|
|
|
|
some layout and formatting, to give users a consistent presentation.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2016-08-07 11:16:30 -07:00
|
|
|
health#report_start({name}) *health#report_start*
|
|
|
|
Starts a new report. Most plugins should call this only once, but if
|
|
|
|
you want different sections to appear in your report, call this once
|
|
|
|
per section.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2016-08-07 11:16:30 -07:00
|
|
|
health#report_info({msg}) *health#report_info*
|
2017-10-15 11:31:12 -07:00
|
|
|
Reports an informational message.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2016-08-07 11:16:30 -07:00
|
|
|
health#report_ok({msg}) *health#report_ok*
|
2017-10-15 11:31:12 -07:00
|
|
|
Reports a "success" message.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 03:00:44 -07:00
|
|
|
health#report_warn({msg}, [{advice}]) *health#report_warn*
|
2017-10-15 11:31:12 -07:00
|
|
|
Reports a warning. {advice} is an optional List of suggestions.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 03:00:44 -07:00
|
|
|
health#report_error({msg}, [{advice}]) *health#report_error*
|
2017-10-15 11:31:12 -07:00
|
|
|
Reports an error. {advice} is an optional List of suggestions.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2016-08-07 11:16:30 -07:00
|
|
|
health#{plugin}#check() *health.user_checker*
|
2017-10-15 11:31:12 -07:00
|
|
|
Healthcheck function for {plugin}. Called by |:checkhealth|
|
|
|
|
automatically. Example: >
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2016-08-07 11:16:30 -07:00
|
|
|
function! health#my_plug#check() abort
|
|
|
|
silent call s:check_environment_vars()
|
|
|
|
silent call s:check_python_configuration()
|
|
|
|
endfunction
|
2016-06-16 14:01:47 -07:00
|
|
|
<
|
2016-08-07 11:16:30 -07:00
|
|
|
All output will be captured from the healthcheck. Use the
|
|
|
|
health#report_* functions so that your healthcheck has a format
|
|
|
|
consistent with the standard healthchecks.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
|
|
|
==============================================================================
|
2017-10-15 11:31:12 -07:00
|
|
|
Create a healthcheck *health-dev*
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
Healthchecks are functions that check the user environment, configuration,
|
|
|
|
etc. Nvim has built-in healthchecks in $VIMRUNTIME/autoload/health/.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
To add a new healthcheck for your own plugin, simply define a
|
2016-08-07 11:16:30 -07:00
|
|
|
health#{plugin}#check() function in autoload/health/{plugin}.vim.
|
2017-10-15 11:31:12 -07:00
|
|
|
|:checkhealth| automatically finds and invokes such functions.
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
If your plugin is named "foo", then its healthcheck function must be >
|
|
|
|
health#foo#check()
|
2016-06-16 14:01:47 -07:00
|
|
|
|
2017-05-01 08:09:29 -07:00
|
|
|
defined in this file on 'runtimepath': >
|
2017-10-15 11:31:12 -07:00
|
|
|
autoload/health/foo.vim
|
2016-08-07 11:16:30 -07:00
|
|
|
|
2017-10-15 11:31:12 -07:00
|
|
|
Copy this sample code into autoload/health/foo.vim and replace "foo" with your
|
|
|
|
plugin name: >
|
|
|
|
function! health#foo#check() abort
|
2016-08-07 11:16:30 -07:00
|
|
|
call health#report_start('sanity checks')
|
|
|
|
" perform arbitrary checks
|
|
|
|
" ...
|
|
|
|
|
|
|
|
if looks_good
|
|
|
|
call health#report_ok('found required dependencies')
|
|
|
|
else
|
2017-10-15 11:31:12 -07:00
|
|
|
call health#report_error('cannot find foo',
|
|
|
|
\ ['npm install --save foo'])
|
2016-08-07 11:16:30 -07:00
|
|
|
endif
|
|
|
|
endfunction
|
2017-05-01 08:09:29 -07:00
|
|
|
|
2016-06-16 14:01:47 -07:00
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
vim:tw=78:ts=8:ft=help:fdm=marker
|