diff options
author | dundargoc <gocdundar@gmail.com> | 2024-06-03 19:04:28 +0200 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-06-08 21:38:06 +0200 |
commit | 9afa1fd35510c5fe485f4a1dfdabf94e5f051a1c (patch) | |
tree | 0a9d7b503db73886b848e4c653119a741d4bf113 /test/functional/lua/fs_spec.lua | |
parent | 4881211097aba7f5d17700362ec0967e3024f074 (diff) | |
download | rneovim-9afa1fd35510c5fe485f4a1dfdabf94e5f051a1c.tar.gz rneovim-9afa1fd35510c5fe485f4a1dfdabf94e5f051a1c.tar.bz2 rneovim-9afa1fd35510c5fe485f4a1dfdabf94e5f051a1c.zip |
feat(lua): add `vim._with`
It's a function to perform operations in their own sealed context,
similar to pythons `with`. This helps ease operations where you need to
perform an operation in a specific context, and then restore the
context.
Marked as private for now as it's not ready for public use. The current
plan is to start using this internally so we can discover and fix any
problems. Once this is ready to be exposed it will be renamed to
`vim.with`.
Usage:
```lua
local ret = vim._with({context = val}, function()
return "hello"
end)
```
, where `context` is any combination of:
- `buf`
- `emsg_silent`
- `hide`
- `horizontal`
- `keepalt`
- `keepjumps`
- `keepmarks`
- `keeppatterns`
- `lockmarks`
- `noautocmd`
- `options`
- `sandbox`
- `silent`
- `unsilent`
- `win`
(except for `win` and `buf` which can't be used at the same time). This
list will most likely be expanded in the future.
Work on https://github.com/neovim/neovim/issues/19832.
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Diffstat (limited to 'test/functional/lua/fs_spec.lua')
0 files changed, 0 insertions, 0 deletions