pi_health.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. *pi_health.txt* Healthcheck framework
  2. Author: TJ DeVries <devries.timothyj@gmail.com>
  3. Type |gO| to see the table of contents.
  4. ==============================================================================
  5. Introduction *health*
  6. health.vim is a minimal framework to help with troubleshooting user
  7. configuration. Nvim ships with healthchecks for configuration, performance,
  8. python support, ruby support, clipboard support, and more.
  9. To run the healthchecks, use this command: >
  10. :checkhealth
  11. <
  12. Plugin authors are encouraged to write new healthchecks. |health-dev|
  13. ==============================================================================
  14. Commands *health-commands*
  15. *:checkhealth* *:CheckHealth*
  16. :checkhealth Run all healthchecks.
  17. *E5009*
  18. Nvim depends on |$VIMRUNTIME| and 'runtimepath' to find
  19. the standard "runtime files" for syntax highlighting,
  20. filetype-specific behavior, and standard plugins
  21. (including :checkhealth). If the runtime files cannot
  22. be found then those features will not work.
  23. :checkhealth {plugins}
  24. Run healthcheck(s) for one or more plugins. E.g. to run
  25. only the standard Nvim healthcheck: >
  26. :checkhealth nvim
  27. < To run the healthchecks for the "foo" and "bar" plugins
  28. (assuming these plugins are on your 'runtimepath' and
  29. they have implemented health#foo#check() and
  30. health#bar#check(), respectively): >
  31. :checkhealth foo bar
  32. <
  33. ==============================================================================
  34. Functions *health-functions*
  35. health.vim functions are for creating new healthchecks. They mostly just do
  36. some layout and formatting, to give users a consistent presentation.
  37. health#report_start({name}) *health#report_start*
  38. Starts a new report. Most plugins should call this only once, but if
  39. you want different sections to appear in your report, call this once
  40. per section.
  41. health#report_info({msg}) *health#report_info*
  42. Reports an informational message.
  43. health#report_ok({msg}) *health#report_ok*
  44. Reports a "success" message.
  45. health#report_warn({msg}, [{advice}]) *health#report_warn*
  46. Reports a warning. {advice} is an optional List of suggestions.
  47. health#report_error({msg}, [{advice}]) *health#report_error*
  48. Reports an error. {advice} is an optional List of suggestions.
  49. health#{plugin}#check() *health.user_checker*
  50. Healthcheck function for {plugin}. Called by |:checkhealth|
  51. automatically. Example: >
  52. function! health#my_plug#check() abort
  53. silent call s:check_environment_vars()
  54. silent call s:check_python_configuration()
  55. endfunction
  56. <
  57. All output will be captured from the healthcheck. Use the
  58. health#report_* functions so that your healthcheck has a format
  59. consistent with the standard healthchecks.
  60. ==============================================================================
  61. Create a healthcheck *health-dev*
  62. Healthchecks are functions that check the user environment, configuration,
  63. etc. Nvim has built-in healthchecks in $VIMRUNTIME/autoload/health/.
  64. To add a new healthcheck for your own plugin, simply define a
  65. health#{plugin}#check() function in autoload/health/{plugin}.vim.
  66. |:checkhealth| automatically finds and invokes such functions.
  67. If your plugin is named "foo", then its healthcheck function must be >
  68. health#foo#check()
  69. defined in this file on 'runtimepath': >
  70. autoload/health/foo.vim
  71. Copy this sample code into autoload/health/foo.vim and replace "foo" with your
  72. plugin name: >
  73. function! health#foo#check() abort
  74. call health#report_start('sanity checks')
  75. " perform arbitrary checks
  76. " ...
  77. if looks_good
  78. call health#report_ok('found required dependencies')
  79. else
  80. call health#report_error('cannot find foo',
  81. \ ['npm install --save foo'])
  82. endif
  83. endfunction
  84. ==============================================================================
  85. vim:tw=78:ts=8:ft=help:fdm=marker