Problem:
after https://github.com/neovim/neovim/pull/32719, `gf` error in lua:
```
E15: Invalid expression: "v:lua.require"vim._ftplugin.lua".includeexpr()"
E447: Can't find file "vim._ftplugin.lua" in path
```
Solution:
* use single quote (no idea why there's two pair double quote in
expression).
* add missing `v:fname`.
Problem: Unpaired marks are shown with `filter.extmarks == true`, which
should only return visible highlights. Misleading `end_col`
included in `inspect_pos()` for unpaired mark; it is set to
`start_col + 1` which would be a visible highlight, which it is
not. Custom "is_here" filter used to get extmarks overlapping a
position.
Solution: Exclude unpaired highlight extmarks with `filter.extmarks == true`.
Set `end_col` to `start_col` for an unpaired mark. Supply
appropriate arguments to nvim_buf_get_extmarks() to return
overlapping extmarks; exclude marks whose end is at `{row, col}`
with `filter.extmarks == true`.
Problem:
Current `'includeexpr'` in runtime/ftplugin/lua.vim doesn't work with Nvim Lua.
Solution:
Provide an improved 'includeexpr' for Lua in "ftplugin/lua.lua".
Closes: https://github.com/neovim/neovim/issues/32490
Problem: Pasting the '.' register multiple times may work incorrectly
when the last insert starts with Ctrl-D and ends with '0'.
(after 9.1.1212)
Solution: Restore the missing assignment (zeertzjq).
closes: vim/vim#1690861b3544424
Problem: too many strlen() calls in edit.c
Solution: refactor edit.c and remove strlen() calls
(John Marriott)
This commit attempts to make edit.c more efficient by:
- in truncate_spaces() pass in the length of the string.
- return a string_T from get_last_insert(), so that the length of the
string is available to the caller.
- refactor stuff_insert():
- replace calls to stuffReadbuff() (which calls STRLEN() on it's
string argument) with stuffReadbuffLen() (which gets the length of
it's string argument passed in).
- replace call to vim_strrchr() which searches from the start of the
string with a loop which searches from end of the string to find the
last ESC character.
- change get_last_insert_save() to call get_last_insert() to get the
last_insert string (the logic is in one place).
closes: vim/vim#1686334954972c2
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: Since 3cb1e825, all windows with 'statuscolumn' set, and a
resized 'signcolumn' for a particular buffer are marked
to be fully redrawn when the first window is encountered.
The "resized" variable is only unset after all windows have
been drawn, so this results in windows that have just been
draw to be marked for redraw again, even though the
signcolumn did not change size again.
Solution: Replace the `resized` variable with a `last_max` variable that
is changed when the first window into buf is encountered.
The "end" termcode is not actually needed for our purposes. And the
suggested $PS1 has trouble with bash's "reverse find" (CTRL-r) feature,
probably because I did it wrong...
* build(contrib): add zsh completion
this is not part of the build system yet, so packager managers are
supposed to install the file by themselves.
bash doesn't seem to provide shell completion, zsh embeds its own
completion that is bundled with vim's.
Instead of copying zsh's completion, this generated one via
https://github.com/RobSis/zsh-completion-generator
---------
Co-authored-by: Eisuke Kawashima <e.kawaschima+github@gmail.com>
Problem: `trigger` is a custom word not yet used in APIs.
Solution: Use `get` instead because the main effect is that the
completion candidates will be collected (and shown by default,
but follow-up commits are planned to add an `on_result` callback
that allows more general handling).
---------
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Problem: :checkhealth fails if plugin has nested "lua/" directory
Solution: trim `{runtimepath}/lua` from fullpath to get subpath
(`./**/{health, health/init.lua}`)
Problem:
The `lua/` tests dir is for Lua stdlib tests. It is not for anything
that randomly happens to be implemented with Lua.
Solution:
Move `lua/runtime_spec.lua` to `editor/runtime_spec.lua`.
Problem: Marks that go beyond the end of the buffer, and paired marks
whose end is in front of its start mark are added to and
removed from the decor. This results in incorrect tracking
of the signcolumn.
Solution: Ensure such marks are not added to and removed from the decor.
Problem:
- Many other ftplugin have defined 'omnifunc', but the Lua one doesn't
define one, even though there is `vim.lua_omnifunc()`
- Users may want "stupid" completion to fix Lua config with
`nvim --clean` in case they breaks it
- Nvim doesn't port Lua foldexpr from Vim
Solution:
- Set 'omnifunc' to 'v:lua.vim.lua_omnifunc' in ftplugin/lua.lua
- Set 'foldexpr' to use treesitter
Problem:
`feed_command()` was added as a "bridge" for old test code. 99% of those
cases should be using `n.command()`, which raises errors instead of
silently continuing the test.
Solution:
Deprecate `feed_command()`. It should not be used in new tests.
All usages of `feed_command()` should be converted to `command()` or
`feed()`.
Problem: Virtual 'statuscolumn' lines are evaluated with a misleading v:(rel)num.
Namely set to the line above for `virt_lines_above = true` lines, or even
the last drawn line for a partial redraw.
Solution: Set `v:lnum` for the first evaluated row of a line, first above
virtual line of a row and first non-virtual line of a row.
Problem: Augroup to close lsp preview hover window is not cleared after
the window is closed because of unmatched group name.
Solution: Delete the augroup before closing the preview window with
correct group name.
Problem: No block events emitted with ext_cmdline for :if, :while, :try etc.
Solution: Emit cmdline block events; store the indent level of the
previous cmdline and whether a block event was emitted.
Problem: tests: test_filetype fails when a file is a directory
(Eisuke Kawashima)
Solution: When encountering a directory instead of a file, skip that
particular filetype test
fixes: vim/vim#1689463a885b650
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: completion: preinserted text not removed when closing pum
Solution: delete preinsert text inside in ins_compl_stop() (glepnir).
closes: vim/vim#1689184a7503e29
Problem: MS-Windows: crash when passing long string to expand() with
'wildignorecase'.
Solution: Use the same buflen as unix_expandpath() in dos_expandpath().
Remove an unnecessary STRLEN() while at it (zeertzjq).
closes: vim/vim#1689600a749bd90
Problem: matchparen keeps cursor on case label in sh filetype
(@categorical, after 9.1.1187).
Solution: Use :defer so that cursor is always restored, remove checks
for older Vims, finish early if Vim does not support :defer
fixes: vim/vim#16887closes: vim/vim#1688847071c6076
Problem: Buffer overflow when expanding long file name.
Solution: Use a larger buffer and avoid overflowing it. (Yee Cheng Chin,
closesvim/vim#12201)
a77670726e
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem:
Test may fail because it matches a Lua table address, and the following
whitespace may differ depending on the stringified address length:
test/functional/lua/loop_spec.lua:233: Row 3 did not match.
Expected:
|{3: }|
|{9:Error executing callback:} |
|*{9:uv_idle_t: 0x{MATCH:%w+}} |
|{6:Press ENTER or type command to continue}^ |
Actual:
|{3: }|
|{9:Error executing callback:} |
|*{9:uv_idle_t: 0xd4c2820a00} |
|{6:Press ENTER or type command to continue}^ |
Solution:
Match a variable amount of whitespace.
Problem:
Given that `vim.snippet.expand()` sets temporary `<tab>`/`<s-tab>`
keymaps there is no way to build "smart-tab" functionality where `<tab>`
chooses the next completion candidate if the popup menu is visible.
Solution:
Set the keymap permanent in `_defaults`.
The downside of this approach is that users of multiple snippet engine's
need to adapt their keymaps to handle all their engines that are in use.
For example:
vim.keymap.set({ 'i', 's' }, "<Tab>", function()
if foreign_snippet.active() then
return "<Cmd>lua require('foreign_snippet').jump()<CR>"
elseif vim.snippet.active({ direction = 1 }) then
return "<Cmd>lua vim.snippet.jump(1)<CR>"
else
return key
end
end, { expr = true })
Upside is that using `vim.keymap.set` to override keymaps is a well
established pattern and `vim.snippet.expand` calls made by nvim itself
or plugins have working keymaps out of the box.
Co-authored-by: Maria José Solano <majosolano99@gmail.com>