mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
5fa26e2c2f
The `split()` VimL function trims empty items from the returned list by default, so that, e.g. split("\nhello\nworld\n\n", "\n") returns ["hello", "world"] The Lua implementation of vim.split does not do this. For example, vim.split("\nhello\nworld\n\n", "\n") returns {'', 'hello', 'world', '', ''} Add an optional parameter to the vim.split function that, when true, trims these empty elements from the front and back of the returned table. This is only possible for vim.split and not vim.gsplit; because vim.gsplit is an iterator, there is no way for it to know if the current item is the last non-empty item. Note that in order to preserve backward compatibility, the parameter for the Lua vim.split function is `trimempty`, while the VimL function uses `keepempty` (i.e. they are opposites). This means there is a disconnect between these two functions that may surprise users. |
||
---|---|---|
.. | ||
api_spec.lua | ||
buffer_updates_spec.lua | ||
command_line_completion_spec.lua | ||
commands_spec.lua | ||
diagnostic_spec.lua | ||
highlight_spec.lua | ||
loop_spec.lua | ||
luaeval_spec.lua | ||
mpack_spec.lua | ||
overrides_spec.lua | ||
runtime_spec.lua | ||
uri_spec.lua | ||
vim_spec.lua | ||
xdiff_spec.lua |