Match '(,'),'[,'],'{, and '} marks in Ex command ranges.
Thanks to Maxim Kim.
Fixesvim/vim#15332.
Closesvim/vim#15337.
d817609b87
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: inserting with a count is inefficient
Solution: Disable calculation of the cursor position and topline, if a
count has been used (Ken Takata)
Optimize insertion when using :normal 10000ix.
This patch optimizes the insertion with a large count (e.g. `:normal
10000ix`).
It seems that calculation of the cursor position for a long line is slow
and it takes O(n^2). Disable the calculation if not needed.
Before:
```
$ time ./vim --clean -c 'normal 10000ix' -cq!
real 0m1.879s
user 0m1.328s
sys 0m0.139s
$ time ./vim --clean -c 'normal 20000ix' -cq!
real 0m5.574s
user 0m5.421s
sys 0m0.093s
$ time ./vim --clean -c 'normal 40000ix' -cq!
real 0m23.588s
user 0m23.187s
sys 0m0.140s
```
After:
```
$ time ./vim --clean -c 'normal 10000ix' -cq!
real 0m0.187s
user 0m0.046s
sys 0m0.093s
$ time ./vim --clean -c 'normal 20000ix' -cq!
real 0m0.217s
user 0m0.046s
sys 0m0.108s
$ time ./vim --clean -c 'normal 40000ix' -cq!
real 0m0.278s
user 0m0.093s
sys 0m0.140s
$ time ./vim --clean -c 'normal 80000ix' -cq!
real 0m0.494s
user 0m0.311s
sys 0m0.140s
$ time ./vim --clean -c 'normal 160000ix' -cq!
real 0m1.302s
user 0m1.140s
sys 0m0.094s
```
closes: vim/vim#1558809b80d23cf
Co-authored-by: Ken Takata <kentkt@csc.jp>
Problem: [security]: invalid cursor position may cause a crash
(after v9.1.0038)
Solution: Set cursor to the last character in a line, if it would
otherwise point to beyond the line; no tests added, as it
is unclear how to reproduce this.
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-4ghr-c62x-cqfh396fd1ec29
Co-authored-by: Christian Brabandt <cb@256bit.org>
Using powershell as the default windows shell as using cmd alters $PATH
in a way that makes building neovim fail (powershell prioritizes visual
studio tools which is arguably more correct).
This was tested with gnu make for windows, which can be installed with
e.g. scoop. It does not work with nmake and it is extremely unlikely we
want to add nmake support as the makefile is merely supposed to be
syntactic sugar for the most common case. For similar reasons, the only
supported generator is ninja.
Problem: completion is inserted on Enter with "noselect"
(Carman Fu)
Solution: check noselect before update compl_shown_match
(glepnir)
fixes: vim/vim#15526closes: vim/vim#15530753794bae8
To check for a non-ASCII character, the condition should be >= 0x80, not
> 0x80. In this case it doesn't really matter as the 0x80 character is
unprintable and occupies 4 cells, but still make it consistent.
Problem: Behavior of Enter in completion depends on typing speed.
Solution: Don't make whether Enter selects original text depend on
whether completion has been interrupted, which can happen
interactively with a slow completion function.
Problem: prefix can be a symbol like period, the fuzzy matching can't
handle it correctly.
Solution: when prefix is empty or a symbol add all lsp completion
result into matches.
Use the grapheme break algorithm from utf8proc to support grapheme
clusters from recent unicode versions.
Handle variant selector VS16 turning some codepoints into double-width
emoji. This means we need to use ptr2cells rather than char2cells when
possible.
Improving syntax highlighting by allowing numbers, - and a $ as suffix
in user constants and by allowing hwConstants in If-Then statements
closes: vim/vim#1505987c01d9561
Co-authored-by: Tom Crecelius <holly@net-eclipse.net>
Problem: completion items can now have dedicated highlighting (through
`hl_group` and `kind_hlgroup` fields). Both of the fields combine
their highlight attributes with the underlying `PmenuXxx` group.
As default color scheme `Pmenu` and `PmenuSel` are intentionally
almost inverted versions of one another, the added highlighting will
be unreadable in one of them if done only through foreground (which is
the most convenient way for users and being able to do so is arguably
the biggest benefit of actually combining added highlighting).
Solution: adjust `PmenuSel` to utilize `attr=reverse`. This works
because `fg`/`bg` are first combined and only then reversed. This
results in a colored background for items with `hl_group` and
`kind_hlgroup` using text highlighting.
This also results in the same background for regular selected item,
while intentionally changing foreground from `Nvim{Light,Dark}Grey3`
to (essentially) `Nvim{Light,Dark}Grey2`. This both provides better
contrast ratio and does not need realigning of the whole block.
Problem:
Things like underlines are always given a default foreground highlight
regardless of the value of `sp`.
Solution:
Check for `sp` first, and apply that color to the text decoration color if it
exists.
Limitations:
If there is no value of `sp`, vim applies a text decoration color that matches
the foreground of the text. This is still not implemented (and seems like a much
more complex problem): in TOhtml, the underline will still be given a default
foreground highlight.
Problem: "dvgo" is not always an inclusive motion
(Iain King-Speir)
Solution: initialize the inclusive flag to false
fixes: vim/vim#15580closes: vim/vim#15582f8702aeb8f
Co-authored-by: Christian Brabandt <cb@256bit.org>
This reverts commit 7f6ff829aa.
The given reasoning and usecase is unsatisfactory. While it is true that
it allows to run `make build/bin/nvim`, it can easily be recreated with
`ninja -C build bin/nvim` which does the exact same thing. This minor
convenience is not worth adding the extra code given how rare this
usecase should be.
Introduce a new API variable "g:java_syntax_previews" whose
value must be a list of syntax preview feature numbers.
Enumerate the currently supported numbers in a table at the
end of the documentation entry for "ft-java-syntax".
Also, disable the recognition of String Templates. Despite
the withdrawal of this preview feature in its proposed form
from the upcoming JDK 23 release and the fact that the JDK
22 release is coming to EOL this September, an earlier
iteration of this preview feature was included in JDK 21
(LTS) whose EOL is projected to fall due in late 2028 and,
therefore, retain the current implementation.
Define "g:java_syntax_previews" and include number 430 in
its list to enable the recognition of String Templates:
------------------------------------------------------------
let g:java_syntax_previews = [430]
------------------------------------------------------------
References:
https://openjdk.org/jeps/430 (Preview)
https://openjdk.org/jeps/459 (Second Preview)
https://openjdk.org/jeps/465 (Third Preview)
https://mail.openjdk.org/pipermail/amber-spec-experts/2024-April/004106.htmlcloses: vim/vim#155798556e23ee9
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Problem: Installing treesitter parser is hard (harder than
climbing to heaven).
Solution: Add optional support for wasm parsers with `wasmtime`.
Notes:
* Needs to be enabled by setting `ENABLE_WASMTIME` for tree-sitter and
Neovim. Build with
`make CMAKE_EXTRA_FLAGS=-DENABLE_WASMTIME=ON
DEPS_CMAKE_FLAGS=-DENABLE_WASMTIME=ON`
* Adds optional Rust (obviously) and C11 dependencies.
* Wasmtime comes with a lot of features that can negatively affect
Neovim performance due to library and symbol table size. Make sure to
build with minimal features and full LTO.
* To reduce re-compilation times, install `sccache` and build with
`RUSTC_WRAPPER=<path/to/sccache> make ...`
Problem: The matchparen plugin is slow on a long line.
Solution: Don't use a regexp to get char at and before cursor.
(zeertzjq)
Example:
```vim
call setline(1, repeat(' foobar', 100000))
runtime plugin/matchparen.vim
normal! $hhhhhhhh
```
closes: vim/vim#1556881e7513c86
Problem: Wrong patlen value in ex_substitute() (after 9.1.0426).
Solution: Compute patlen after finding end separator.
(zeertzjq)
Add a more explicit test. The test already passes as the only case
where a overlarge patlen value matters was fixed by patch 9.1.0689.
closes: vim/vim#15565d1c8d2de4b
Problem: cannot set special highlight kind in popupmenu
Solution: add kind_hlgroup item to complete function
(glepnir)
closes: vim/vim#1556138f99a1f0d
Co-authored-by: glepnir <glephunter@gmail.com>
Match :loadkeymap after Ex colons and bars.
Don't generate :loadkeymap as it is matched with a custom syntax group.
closes: vim/vim#155547866d54ecc
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
The end marker is not required to match the indent of :let when "trim"
is specified, it may also appear without leading whitespace as normal.
closes: vim/vim#155647884cc7418
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
* Improve heredoc handling
- Support "trim" for all the embedded scripts.
- Check the indent of "trim" for "let" and all the embedded scripts.
* Update missing part of vim.vim.base in the commit
d164f2a521f8e52e587727657fb1c19e9a25f32a.
* Update gen_syntax_vim.vim to catch up with 9.1.0685's source code.
closes: vim/vim#1554295e90781a4
Co-authored-by: Ken Takata <kentkt@csc.jp>
- Obtain and pass through translated messages with this
function.
- If "g:java_foldtext_show_first_or_second_line" is defined,
assign this function to &foldtext.
closes: vim/vim#155492750b83fa1
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>