-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat(lua)!: execute Lua with "nvim -l" #18706
Conversation
25a30a4
to
373fef4
Compare
467bd4c
to
b61ff21
Compare
test failing on windows... is there a problem with getting output from |
69787e2
to
2f102ad
Compare
Maybe some Vim patches are missing for |
61753fc
to
903fe3f
Compare
9d4be15
to
6cf0892
Compare
thank you for the help! actually Nvim was crashing (bug in |
after merging this,
|
216a3da
to
64f0764
Compare
@@ -281,6 +283,8 @@ jobs: | |||
DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps | |||
CACHE_NVIM_DEPS_DIR: ${{ github.workspace }}/nvim-deps | |||
DEPS_PREFIX: ${{ github.workspace }}/nvim-deps/usr | |||
# TEST_FILE: test/functional/core/startup_spec.lua | |||
# TEST_FILTER: foo |
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.
Leaving this here and documented in CONTRIBUTING.md to help others.
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.
Just put one set of environment variables at the top level instead?
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.
That didn't seem to work when I tried it...
ca337de
to
8469218
Compare
Problem: Nvim has Lua but the "nvim" CLI can't easily be used to execute Lua scripts, especially scripts that take arguments or produce output. Solution: - support "nvim -l [args...]" for running scripts. closes neovim#15749 - exit without +q - remove lua2dox_filter - remove Doxyfile. This wasn't used anyway, because the doxygen config is inlined in gen_vimdoc.py (`Doxyfile` variable). - use "nvim -l" in docs-gen CI job Examples: $ nvim -l scripts/lua2dox.lua --help Lua2DoX (0.2 20130128) ... $ echo "print(vim.inspect(_G.arg))" | nvim -l - --arg1 --arg2 $ echo 'print(vim.inspect(vim.api.nvim_buf_get_text(1,0,0,-1,-1,{})))' | nvim +"put ='text'" -l - TODO? -e executes Lua code -l loads a module -i enters REPL _after running the other arguments_.
Problem: When "-l" is followed by "--", we stop sending args to the Lua script and treat "--" in the usual way. This was for flexibility but didn't have a strong use-case, and has these problems: - prevents Lua "-l" scripts from handling "--" in their own way. - complicates the startup logic (must call nlua_init before command_line_scan) Solution: Don't treat "--" specially if it follows "-l".
also de-dupe the code
ci failure looks unrelated:
|
Examples
closes #15749
Todo
+q
-l -
(stdin)vim.is_main()
magic function that detects whether the current module is the thing executed bynvim -l
._G.arg[0]
lua: "nvim -l" scriptname in _G.arg[0], eliminate bump-deps.sh #21663verbose==1
\n
in output?Future
To run tests with
nvim
instead oflua
orluajit
, change.deps/usr/bin/busted
script as follows:With this PR, plus this patch:
tests run successfully using
nvim
as the test runner:and fail correctly: