aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua
Commit message (Collapse)AuthorAge
* fix(api, lua): return NIL on failure to find converted function (#17779)zeertzjq2022-03-20
|
* Merge pull request #17459 from rktjmp/lua-error-tostringbfredl2022-03-18
|\ | | | | feat: __tostring lua errors if possible before showing in messages
| * feat: call __tostring on lua errors if possible before reporting to userOliver Marriott2022-02-25
| |
* | feat(api, lua): support converting nested Funcref back to LuaRef (#17749)zeertzjq2022-03-17
| |
* | refactor: fix clint warnings (#17682)dundargoc2022-03-13
| |
* | refactor(uncrustify): format all c filesDundar Göc2022-03-10
| |
* | chore(lgtm): fix "empty block without comment" warningsDundar Göc2022-03-09
| |
* | fix(lua): don't use nlua_error when exiting earlybfredl2022-03-07
| | | | | | | | Screen state is not initialized yet. Print directly to stderr instead.
* | refactor(lua): move only runtime lua file in src/ to runtime/luabfredl2022-03-04
| | | | | | | | reorganize so that initialization is done in lua
* | refactor(lua): reorganize builtin modules, phase 1bfredl2022-03-03
| |
* | Merge pull request #15079 from shadmansaleh/feat/verbose_luabfredl2022-03-01
|\ \ | | | | | | feat(lua): add :verbose support for lua config
| * | fix: anonymous sid not workingshadmansaleh2022-02-28
| | |
| * | feat(lua): show proper verbose output for lua configurationshadmansaleh2022-02-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `:verbose` didn't work properly with lua configs (For example: options or keymaps are set from lua, just say that they were set from lua, doesn't say where they were set at. This fixes that issue. Now `:verbose` will provide filename and line no when option/keymap is set from lua. Changes: - compiles lua/vim/keymap.lua as vim/keymap.lua - When souring a lua file current_sctx.sc_sid is set to SID_LUA - Moved finding scripts SID out of `do_source()` to `get_current_script_id()`. So it can be reused for lua files. - Added new function `nlua_get_sctx` that extracts current lua scripts name and line no with debug library. And creates a sctx for it. NOTE: This function ignores C functions and blacklist which currently contains only vim/_meta.lua so vim.o/opt wrappers aren't targeted. - Added function `nlua_set_sctx` that changes provided sctx to current lua scripts sctx if a lua file is being executed. - Added tests in tests/functional/lua/verbose_spec.lua - add primary support for additional types (:autocmd, :function, :syntax) to lua verbose Note: These can't yet be directly set from lua but once that's possible :verbose should work for them hopefully :D - add :verbose support for nvim_exec & nvim_command within lua Currently auto commands/commands/functions ... can only be defined by nvim_exec/nvim_command this adds support for them. Means if those Are defined within lua with vim.cmd/nvim_exec :verbose will show their location . Though note it'll show the line no on which nvim_exec call was made.
* | | feat(lua): add missing changes to autocmds lost in the rebaseTJ DeVries2022-02-28
|/ / | | | | | | Note: some of these changes are breaking, like change of API signatures
* | feat(lua): add api and lua autocmdsTJ DeVries2022-02-27
| |
* | feat(lua): add <f-args> to user commands callback (#17522)Javier Lopez2022-02-27
| | | | | | | | | | Works similar to ex <f-args>. It only splits the arguments if the command has more than one posible argument. In cases were the command can only have 1 argument opts.fargs = { opts.args }
* | refactor(lua): cleanup and docs for threadsbfredl2022-02-26
| |
* | refactor(lua): use references directly on main threadBjörn Linse2022-02-26
| |
* | feat(lua): add proper support of luv threadserw72022-02-26
|/
* refactor(lua): call loadfile internallyLewis Russell2022-02-18
| | | | | | .. instead of luaL_loadfile allows files to be cached
* fix: autoload variables not loaded with vim.g & nvim_get_varshadmansaleh2022-02-13
|
* fix(lua): restore priority of the preloaderLewis Russell2022-02-05
| | | | | | | | | Neovim currently places its own loader for searching runtime files at the front of `package.loaders`. This prevents any preloaders in `package.preload` from being used. This change fixes that by moving the default package preloader to run before Neovim's loader. For example, LuaJIT provides preloaders for the built-in modules `ffi` and `bit`, so this optimisation will improve the loading of those.
* fix(diff): make algorithm work for vim.diff (#17300)Lewis Russell2022-02-05
| | | Fixes #17207
* vim-patch:8.2.4241: some type casts are redundantDundar Göc2022-01-30
| | | | | | | | Problem: Some type casts are redundant. Solution: Remove the type casts. (closes vim/vim#9643) https://github.com/vim/vim/commit/420fabcd4ffeaf79082a6e43db91e1d363f88f27 This is not a literal port but an equivalent one.
* feat(ts): expose minimum language version to lua (#17186)Thomas Vigouroux2022-01-27
|
* refactor(coverity/345583): assert fp is non-NULLJames McCoy2022-01-19
| | | | Since we already have a typval, we know the lookup will succeed.
* feat(api, lua): more conversions between LuaRef and Vim Funcrefzeertzjq2022-01-13
|
* feat(treesitter): set allocator when possibleThomas Vigouroux2022-01-09
| | | | | Adds a new cmake check to keep this backwards compatible with the different versions of tree-sitter.
* fix(lua): print multiple return values with =expr (#16933)Shadman2022-01-06
|
* feat(lua): add notify_once() (#16956)Gregory Anders2022-01-06
| | | Like vim.notify(), but only displays the notification once.
* feat(lua): add vim.keymapshadmansaleh2022-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | This introduces two new functions `vim.keymap.set` & `vim.keymap.del` differences compared to regular set_keymap: - remap is used as opposite of noremap. By default it's true for <Plug> keymaps and false for others. - rhs can be lua function. - mode can be a list of modes. - replace_keycodes option for lua function expr maps. (Default: true) - handles buffer specific keymaps Examples: ```lua vim.keymap.set('n', 'asdf', function() print("real lua function") end) vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, {buffer=true}) vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", {silent = true, buffer = 5 }) vim.keymap.set('i', '<Tab>', function() return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>" end, {expr = true}) vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)') vim.keymap.del('n', 'asdf') vim.keymap.del({'n', 'i', 'v'}, '<leader>w', {buffer = 5 }) ```
* feat: filetype.lua (#16600)Gregory Anders2022-01-04
| | | | Adds a new vim.filetype module that provides support for filetype detection in Lua.
* feat(lua): make =expr print result of exprshadmansaleh2022-01-04
|
* fix(lua): stricter type check when calling API function (#16745)dundargoc2022-01-03
| | | | | Solves #13651 Co-authored-by: Gregory Anders <greg@gpanders.com>
* refactor(PVS/V009): add special comment at top of file required by PVSDundar Göc2022-01-01
| | | | More info: https://pvs-studio.com/en/docs/warnings/v009/
* Merge pull request #16752 from gpanders/lua-user-commandsBjörn Linse2021-12-28
|\ | | | | feat(api): implement nvim_{add,del}_user_command
| * feat(api): implement nvim_{add,del}_user_commandGregory Anders2021-12-28
| | | | | | | | | | Add support for adding and removing custom user commands with the Nvim API.
* | chore: fix typos (#16506)dundargoc2021-12-28
|/ | | | | | | | | Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com> Co-authored-by: Alef Pereira <ealefpereira@gmail.com> Co-authored-by: AusCyber <willp@outlook.com.au> Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
* feat(lua): add vim.spell (#16620)Lewis Russell2021-12-25
|
* perf: pre-compile embedded Lua source into bytecode (#16631)Gregory Anders2021-12-16
| | | | | | The Lua modules that make up vim.lua are embedded as raw source files into the nvim binary. These sources are loaded by the Lua runtime on startuptime. We can pre-compile these sources into Lua bytecode before embedding them into the binary, which minimizes the size of the binary and improves startuptime.
* Merge pull request #16666 from mjlbach/fix/bad-castMichael Lingelbach2021-12-15
|\
| * chore: improve naming consistency in str_utf_startMichael Lingelbach2021-12-15
| |
| * fix: do not cast offset to char_uMichael Lingelbach2021-12-15
| | | | | | | | | | | | | | * str_utf_start/end both cast the offset into the utf string to a char_u, a pointer + long is well-defined and the cast is unnecessary. This previously resulted in issues for offsets greater than 256.
* | refactor(misc1): move out high-level input functions to a new file: input.cBjörn Linse2021-12-10
|/ | | | | Possibly dialog code is messages.c could be moved here as well. misc1.c is now empty, so delete it.
* fix: check for interrupt in nvim_echo, write_msg and nlua_print (#16537)ii142021-12-08
| | | | | Fixes `q` in more pager, where `:highlight` can be quit out of with a single `q` keystroke, while in `:lua print(vim.inspect(vim))` it just scrolls down a page.
* Merge pull request #16411 from dundargoc/refactor/upgrade-uncrustifyBjörn Linse2021-12-04
|\ | | | | refactor: upgrade uncrustify config version to 0.74.0
| * refactor: upgrade uncrustify config version to 0.74.0Dundar Göc2021-11-23
| | | | | | | | | | Disable formatting for assert.h since there's a bug that results in a segmentation fault in uncrustify.
* | docs(lsp): add annotations for private functionsGregory Anders2021-11-30
| |
* | chore: fix typosii142021-11-30
| | | | | | | | Co-authored-by: ii14 <ii14@users.noreply.github.com>
* | fix: allow str_utfindex second argument to be an explicit nil (#16448)Michael Lingelbach2021-11-27
| | | | | | | | | | | | * str_utfindex checks number of arguments only, but ignores the case in which the second argument is an explicit nil. Previously this required dropping the second argument entirely. * Modify the C binding to explicitly check if the second argument is nil