diff options
author | dundargoc <gocdundar@gmail.com> | 2024-05-22 16:07:45 +0200 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-05-22 20:15:17 +0200 |
commit | e8f7025de1d8b7c8bbe747736e4c46dcd6e73133 (patch) | |
tree | 6dba4440bc8bef6a9a205b08e5ebb18e518a420f /runtime/doc | |
parent | 339129ebc9503883a3f060d3eff620d67a9eadaf (diff) | |
download | rneovim-e8f7025de1d8b7c8bbe747736e4c46dcd6e73133.tar.gz rneovim-e8f7025de1d8b7c8bbe747736e4c46dcd6e73133.tar.bz2 rneovim-e8f7025de1d8b7c8bbe747736e4c46dcd6e73133.zip |
docs: move vim.health documentation to lua.txt
`vim.health` is not a "plugin" but part of our Lua API and the
documentation should reflect that. This also helps make the
documentation maintenance easier as it is now generated.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/help.txt | 1 | ||||
-rw-r--r-- | runtime/doc/lua.txt | 125 | ||||
-rw-r--r-- | runtime/doc/pi_health.txt | 122 |
3 files changed, 125 insertions, 123 deletions
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 7545d2c621..f2deac3cd8 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -175,7 +175,6 @@ DEVELOPING NVIM Standard plugins ~ *standard-plugin-list* |pi_gzip.txt| Reading and writing compressed files -|pi_health.txt| Healthcheck framework |pi_msgpack.txt| msgpack utilities |pi_netrw.txt| Reading and writing files over a network |pi_paren.txt| Highlight matching parens diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index fccda177d2..76a6bc0801 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -4430,4 +4430,129 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()* (`string[]`) +============================================================================== +Lua module: vim.health *vim.health* + + +health.vim is a minimal framework to help users troubleshoot configuration and +any other environment conditions that a plugin might care about. Nvim ships +with healthchecks for configuration, performance, python support, ruby +support, clipboard support, and more. + +To run all healthchecks, use: >vim + + :checkhealth +< +Plugin authors are encouraged to write new healthchecks. |health-dev| + +Commands *health-commands* + + *:che* *:checkhealth* +:che[ckhealth] Run all healthchecks. + *E5009* + Nvim depends on |$VIMRUNTIME|, 'runtimepath' and 'packpath' 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. + +:che[ckhealth] {plugins} + Run healthcheck(s) for one or more plugins. E.g. to run only + the standard Nvim healthcheck: >vim + :checkhealth vim.health +< + To run the healthchecks for the "foo" and "bar" plugins + (assuming they are on 'runtimepath' and they have implemented + the Lua `require("foo.health").check()` interface): >vim + :checkhealth foo bar +< + To run healthchecks for Lua submodules, use dot notation or + "*" to refer to all submodules. For example Nvim provides + `vim.lsp` and `vim.treesitter`: >vim + :checkhealth vim.lsp vim.treesitter + :checkhealth vim* +< + +Create a healthcheck *health-dev* + +Healthchecks are functions that check the user environment, configuration, or +any other prerequisites that a plugin cares about. Nvim ships with +healthchecks in: + - $VIMRUNTIME/autoload/health/ + - $VIMRUNTIME/lua/vim/lsp/health.lua + - $VIMRUNTIME/lua/vim/treesitter/health.lua + - and more... + +To add a new healthcheck for your own plugin, simply create a "health.lua" +module on 'runtimepath' that returns a table with a "check()" function. Then +|:checkhealth| will automatically find and invoke the function. + +For example if your plugin is named "foo", define your healthcheck module at +one of these locations (on 'runtimepath'): + - lua/foo/health/init.lua + - lua/foo/health.lua + +If your plugin also provides a submodule named "bar" for which you want +a separate healthcheck, define the healthcheck at one of these locations: + - lua/foo/bar/health/init.lua + - lua/foo/bar/health.lua + +All such health modules must return a Lua table containing a `check()` +function. + +Copy this sample code into `lua/foo/health.lua`, replacing "foo" in the path +with your plugin name: >lua + + local M = {} + + M.check = function() + vim.health.start("foo report") + -- make sure setup function parameters are ok + if check_setup() then + vim.health.ok("Setup is correct") + else + vim.health.error("Setup is incorrect") + end + -- do some more checking + -- ... + end + + return M + + +vim.health.error({msg}, {...}) *vim.health.error()* + Reports an error. + + Parameters: ~ + • {msg} (`string`) + • {...} (`string|string[]`) Optional advice + +vim.health.info({msg}) *vim.health.info()* + Reports an informational message. + + Parameters: ~ + • {msg} (`string`) + +vim.health.ok({msg}) *vim.health.ok()* + Reports a "success" message. + + Parameters: ~ + • {msg} (`string`) + +vim.health.start({name}) *vim.health.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. + + Parameters: ~ + • {name} (`string`) + +vim.health.warn({msg}, {...}) *vim.health.warn()* + Reports a warning. + + Parameters: ~ + • {msg} (`string`) + • {...} (`string|string[]`) Optional advice + + vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt deleted file mode 100644 index bcc933d8b2..0000000000 --- a/runtime/doc/pi_health.txt +++ /dev/null @@ -1,122 +0,0 @@ -*pi_health.txt* Healthcheck framework - -Author: TJ DeVries <devries.timothyj@gmail.com> - - Type |gO| to see the table of contents. - -============================================================================== -Introduction *health* - -health.vim is a minimal framework to help users troubleshoot configuration and -any other environment conditions that a plugin might care about. Nvim ships -with healthchecks for configuration, performance, python support, ruby -support, clipboard support, and more. - -To run all healthchecks, use: >vim - - :checkhealth -< -Plugin authors are encouraged to write new healthchecks. |health-dev| - -============================================================================== -Commands *health-commands* - - *:che* *:checkhealth* -:che[ckhealth] Run all healthchecks. - *E5009* - Nvim depends on |$VIMRUNTIME|, 'runtimepath' and 'packpath' 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. - -:che[ckhealth] {plugins} - Run healthcheck(s) for one or more plugins. E.g. to run only - the standard Nvim healthcheck: >vim - :checkhealth nvim -< - To run the healthchecks for the "foo" and "bar" plugins - (assuming they are on 'runtimepath' and they have implemented - the Lua `require("foo.health").check()` interface): >vim - :checkhealth foo bar -< - To run healthchecks for Lua submodules, use dot notation or - "*" to refer to all submodules. For example Nvim provides - `vim.lsp` and `vim.treesitter`: >vim - :checkhealth vim.lsp vim.treesitter - :checkhealth vim* -< -============================================================================== -Functions *health-functions* *vim.health* - -The Lua "health" module can be used to create new healthchecks. To get started -see |health-dev|. - -vim.health.start({name}) *vim.health.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. - -vim.health.info({msg}) *vim.health.info()* - Reports an informational message. - -vim.health.ok({msg}) *vim.health.ok()* - Reports a "success" message. - -vim.health.warn({msg} [, {advice}]) *vim.health.warn()* - Reports a warning. {advice} is an optional list of suggestions to - present to the user. - -vim.health.error({msg} [, {advice}]) *vim.health.error()* - Reports an error. {advice} is an optional list of suggestions to - present to the user. - -============================================================================== -Create a healthcheck *health-dev* - -Healthchecks are functions that check the user environment, configuration, or -any other prerequisites that a plugin cares about. Nvim ships with -healthchecks in: - - $VIMRUNTIME/autoload/health/ - - $VIMRUNTIME/lua/vim/lsp/health.lua - - $VIMRUNTIME/lua/vim/treesitter/health.lua - - and more... - -To add a new healthcheck for your own plugin, simply create a "health.lua" -module on 'runtimepath' that returns a table with a "check()" function. Then -|:checkhealth| will automatically find and invoke the function. - -For example if your plugin is named "foo", define your healthcheck module at -one of these locations (on 'runtimepath'): - - lua/foo/health/init.lua - - lua/foo/health.lua - -If your plugin also provides a submodule named "bar" for which you want -a separate healthcheck, define the healthcheck at one of these locations: - - lua/foo/bar/health/init.lua - - lua/foo/bar/health.lua - -All such health modules must return a Lua table containing a `check()` -function. - -Copy this sample code into `lua/foo/health.lua`, replacing "foo" in the path -with your plugin name: >lua - - local M = {} - - M.check = function() - vim.health.start("foo report") - -- make sure setup function parameters are ok - if check_setup() then - vim.health.ok("Setup is correct") - else - vim.health.error("Setup is incorrect") - end - -- do some more checking - -- ... - end - - return M - - -vim:et:tw=78:ts=8:ft=help:fdm=marker |