feat(lua)!: execute Lua with "nvim -l"

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 #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_.
This commit is contained in:
Justin M. Keyes
2021-09-20 19:00:50 -07:00
parent 39d70fcafd
commit 7c94bcd2d7
16 changed files with 311 additions and 2784 deletions

View File

@@ -23,15 +23,17 @@ typedef struct {
char cmds_tofree[MAX_ARG_CMDS]; // commands that need free()
int n_pre_commands; // no. of commands from --cmd
char *pre_commands[MAX_ARG_CMDS]; // commands from --cmd argument
char *luaf; // Lua script filename from "-l"
int edit_type; // type of editing to do
char *tagname; // tag from -t argument
char *use_ef; // 'errorfile' from -q argument
bool input_isatty; // stdin is a terminal
bool input_istext; // stdin is text, not executable (-E/-Es)
bool output_isatty; // stdout is a terminal
bool err_isatty; // stderr is a terminal
bool input_neverscript; // never treat stdin as script (-E/-Es)
int no_swap_file; // "-n" argument used
int use_debug_break_level;
int window_count; // number of windows to use