-
-
Notifications
You must be signed in to change notification settings - Fork 638
docs(#3088): unify help generation and lint into vimdoc.sh, generation uses nvim source build to execute #3260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alex-courtis
merged 4 commits into
3088-gen_vimdoc-api-3231-remove-api-requires
from
3088-fix-and-unify-doc-generate-and-lint
Feb 3, 2026
+108
−141
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5ac0950
docs(#3241): unify help generation and lint into vimdoc.sh, generatio…
alex-courtis 7e2446b
docs(#3241): unify help generation and lint into vimdoc.sh, generatio…
alex-courtis 664f83a
docs(#3241): unify help generation and lint into vimdoc.sh, generatio…
alex-courtis 92074b6
docs(#3241): unify help generation and lint into vimdoc.sh, generatio…
alex-courtis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #!/usr/bin/env sh | ||
|
|
||
| # Wrapper around Nvim make targets: | ||
| # | ||
| # make doc - gen_vimdoc.lua | ||
| # Generates doc/nvim-tree-lua.txt | ||
| # Uses nvim-tree sources defined in scripts/vimdoc_config.lua | ||
| # Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config. | ||
| # | ||
| # make lintdoc - lintdoc.lua | ||
| # Validates doc/nvim-tree-lua.txt | ||
| # Desired: | ||
| # - tags valid | ||
| # - links valid | ||
| # Also: | ||
| # - brand spelling, notably Nvim and Lua | ||
| # | ||
| # There are some hardcoded expectations which we work around as commented. | ||
|
|
||
| set -e | ||
|
|
||
| if [ $# -ne 1 ] || [ "${1}" != "doc" ] && [ "${1}" != "lintdoc" ]; then | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the nvim make targets. |
||
| echo "usage: ${0} <doc|lintdoc>" 1>&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| DIR_NVIM_SRC_DEF="/tmp/src/neovim-stable" | ||
|
|
||
| if [ ! -d "lua/nvim-tree" ]; then | ||
| echo "Must be run from nvim-tree root" 1>&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${DIR_NVIM_SRC}" ] && [ -d "${DIR_NVIM_SRC_DEF}" ]; then | ||
| export DIR_NVIM_SRC="${DIR_NVIM_SRC_DEF}" | ||
| fi | ||
|
|
||
| if [ ! -d "${DIR_NVIM_SRC}" ]; then | ||
| cat << EOM | ||
|
|
||
| Nvim source v0.11+ is required to run ${0} | ||
|
|
||
| Unavailable: ${DIR_NVIM_SRC_DEF} or \$DIR_NVIM_SRC=${DIR_NVIM_SRC} | ||
|
|
||
| Please: | ||
| mkdir -p ${DIR_NVIM_SRC_DEF} | ||
| curl -L 'https://github.com/neovim/neovim/archive/refs/tags/stable.tar.gz' | tar zx --directory $(dirname "${DIR_NVIM_SRC_DEF}") | ||
| or use your own e.g. | ||
| export DIR_NVIM_SRC="\${HOME}/src/neovim" | ||
|
|
||
| EOM | ||
| exit 1 | ||
| fi | ||
|
|
||
| cleanup() { | ||
| # remove source link | ||
| rm -fv "${DIR_NVIM_SRC}/runtime/lua/nvim_tree" | ||
|
|
||
| # remove our config | ||
| rm -fv "${DIR_NVIM_SRC}/src/gen/vimdoc_config.lua" | ||
|
|
||
| # remove generated help | ||
| rm -fv "${DIR_NVIM_SRC}/runtime/doc/nvim-tree-lua.txt" | ||
|
|
||
| # revert generator if present | ||
| if [ -f "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua.org" ]; then | ||
| mv -v "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua.org" "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" | ||
| fi | ||
| } | ||
|
|
||
| # clean up any previous failed runs | ||
| cleanup | ||
|
|
||
| # runtime/doc is hardcoded, copy the help in | ||
| cp -v "doc/nvim-tree-lua.txt" "${DIR_NVIM_SRC}/runtime/doc" | ||
|
|
||
| # setup doc generation | ||
| if [ "${1}" = "doc" ]; then | ||
| # runtime/lua is available, link our sources in there | ||
| # gen_vimdoc.lua doesn't like dashes in lua module names | ||
| # -> use nvim_tree instead of nvim-tree | ||
| ln -sv "${PWD}/lua/nvim-tree" "${DIR_NVIM_SRC}/runtime/lua/nvim_tree" | ||
|
|
||
| # modify gen_vimdoc.lua to use our config, backing up original | ||
| cp "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua.org" | ||
| sed -i -E 's/spairs\(config\)/spairs\(require("gen.vimdoc_config")\)/g' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" | ||
|
|
||
| # copy our config | ||
| cp -v "scripts/vimdoc_config.lua" "${DIR_NVIM_SRC}/src/gen" | ||
| fi | ||
|
|
||
| # run from within Nvim source | ||
| cd "${DIR_NVIM_SRC}" | ||
| make "${1}" | ||
| cd - | ||
|
|
||
| # copy the generated help out | ||
| cp -v "${DIR_NVIM_SRC}/runtime/doc/nvim-tree-lua.txt" "doc" | ||
|
|
||
| # cleanup as everything succeeded | ||
| cleanup | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that doc is successful without our changes for easier diagnosis.