On man-db systems, complete with actual man sections and pages, instead
of shell commands.
I tried to come up with a portable solution for multiple man
implementations in https://github.com/vim/vim/discussions/16794 but I
think the differences between implementations were too large to do that
without overly complicated code. So instead, I implemented it for man-db
(which I think is common on Linux) and hopefully left it easier for
other people to implement it on other systems in the future if they want
to.
closes: #16843
Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Unnecessary use of STRCAT() in au_event_disable(). STRCAT()
seeks to the end of new_ei, but here the end is already known.
Solution: Use STRCPY() and add p_ei_len to new_ei. Also fix a typo in a
comment. Add a test that 'eventignore' works in :argdo
(zeertzjq).
closes: #16844
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim crashes with term response debug logging enabled and
running in a non-writeable directory
Solution: use ch_log() instead of custom termresponse logging function
(Hirohito Higashi)
closes: #16840
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Only match valid predefined and option variables.
- Match scope dictionaries.
- Highlight scope prefixed variables as a scope dictionary accessor. The
vimVarScope syntax group can be linked to vimVar to disable this.
- Include support for Neovim-only predefined and option variables.
Temporary collateral damage - scope dictionaries match instead of keys
in dictionary literals.
closes: #16727
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Test for patch 9.1.1186 doesn't fail without the patch.
Solution: Set 'nomodeline' in the test (zeertzjq).
closes: #16835
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: if_python: build error due to incompatible pointer types
Solution: cast pointer to PyObject* (oreo639)
Avoid build failure due to -Wincompatible-pointer-types becoming an error in
gcc 14.
When Py_LIMITED_API is < 0x030b0000, then the for Py_XDECREF must be PyObject*.
Vim targets Py_LIMITED_API = 0x03080000 (python 3.8).
closes: #16824
Signed-off-by: oreo639 <oreo6391@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: runtime(tera): tera support can be improved
Solution: update tera filetype plugin, include a tera syntax script
include tera syntax tests, update the filetype test,
update makemenu and synmenu vim scripts
(MuntasirSZN)
closes: #16830
Signed-off-by: MuntasirSZN <muntasir.joypurhat@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: matchparen plugin wrong highlights shell case statement
(Swudu Susuwu)
Solution: return early, if we are in a shSnglCase syntax element
The shell syntax element "case $var in foobar)" uses closing parenthesis
but there is no corresponding opening parenthesis for that syntax
element. However matchparen is not aware of such things and will happily
try to match just the next opening parenthesis.
So let's just add a way to opt out for such cases. In this case, use the
syntax state to check if the closing parenthesis belongs to the syntax
item "shSnglCase" and if it is, do not try to find a corresponding
opening parenthesis.
Since inspecting the syntax state might be expensive, put the whole
check behind a filetype test, so that matchparen will only perform this
particular check, when it knows the current buffer is a "sh" filetype.
fixes: #16801closes: #16831
Signed-off-by: Christian Brabandt <cb@256bit.org>
It's called "GNOME Terminal" in
https://gitlab.gnome.org/GNOME/gnome-terminal It's also called GNOME
Terminal in English Wikipedia
https://en.wikipedia.org/wiki/GNOME_Terminal and the Wikipedia pages of
8 other languages.
Also, make line wrapping the same in insert.txt and cmdline.txt.
closes: #16832
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: help files in git repos are not detected
Solution: detect */doc/*.txt files as help if they end with a help
modeline, even if 'modeline' is off
Here's how I checked that this would still detect vim's own help files
correctly:
$ find . -type f -path '*/doc/*.txt' \
> -exec awk '{ } ENDFILE { print FILENAME ":" $0; }' '{}' + |
> grep -v 'vim:.*\<\(ft\|filetype\)=help\>'
./src/libvterm/doc/seqs.txt: 23 DECSM 42 = DECNRCM, national/multinational character
closes: #16817
Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
fix exception when entering the insert mode with paste
closes: #16818
Co-authored-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: qaqland <qaq@qaq.land>
Signed-off-by: Christian Brabandt <cb@256bit.org>
* Accommodate the calling of "EraseLineAndReturnCarriage()"
to not interfere with the "skipped" and "failed" reports.
* Create the "failed" directory, if unavailable, without
relying on "VerifyScreenDump()" to do it so that reporting
with "Xtestscript#s:AssertCursorForwardProgress()" can be
uniformly attempted.
* Make an only list copy of the "Xtestscript" contents and
share it with every syntax test.
* Narrow the scope of the "filetype" and "failed_root" local
variables.
closes: #16789
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: endless loop with completefuzzycollect and no match found
Solution: move pointer to line end and break loop
closes: #16820
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Unnecessary use of vim_tolower() in vim_strnicmp_asc().
Solution: Use TOLOWER_ASC() instead (zeertzjq).
It was passing *s1 and *s2 to vim_tolower(). When char is signed, which
is the case on most platforms, c < 0x80 is always true, so it already
behaves the same as TOLOWER_ASC().
closes: #16826
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: "above" virtual text breaks cursorlineopt=number.
Solution: Take "above" virtual text into account when applying
CursorLineNr highlight.
fixes: #16828closes: #16829
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
As of patch v9.1.1176~1, there are no longer makeshift Make
targets to accommodate language names that can match phoney
targets. For example, "clean_" was previously generated for
Clean because otherwise it clashed with the "clean" target.
Additionally, enable test filtering for makeshift targets.
Reference:
https://wiki.clean.cs.ru.nl/Cleancloses: #16810
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: No cmdline completion for the 'completefuzzycollect' option
(after v9.1.1178)
Solution: Add cmdline completion for the 'completefuzzycollect' option,
improve its description in optwin.vim (zeertzjq).
closes: #16813
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Unnecessary STRLEN() calls in insexpand.c (after 9.1.1178).
Solution: Use the already available length (zeertzjq).
closes: #16814
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The meaning of <Tab> depends on unspecified behavior
(after 9.1.1179).
Solution: Return TAB in case bsearch() finds K_TAB. Rename alt_name to
pref_name as that's closer to it meaning (zeertzjq).
The man page of bsearch() says:
The bsearch() function returns a pointer to a matching member of the
array, or NULL if no match is found. If there are multiple elements
that match the key, the element returned is unspecified.
So it's possible that bsearch() finds K_TAB instead of TAB when trying
to get the key code for <Tab>. Actually, it can happen when adding a
single key to end of the table:
closes: #16821
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/misc2.c b/src/misc2.c
index 151745ca2..90f108a24 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1141,7 +1141,8 @@ static struct key_name_entry
{TRUE, K_XRIGHT, STRING_INIT("xRight"), NULL},
{TRUE, K_XUP, STRING_INIT("xUp"), NULL},
{TRUE, K_ZEND, STRING_INIT("zEnd"), NULL},
- {TRUE, K_ZHOME, STRING_INIT("zHome"), NULL}
+ {TRUE, K_ZHOME, STRING_INIT("zHome"), NULL},
+ {TRUE, -1, STRING_INIT("zzDummyKey"), NULL}
// NOTE: When adding a long name update MAX_KEY_NAME_LEN.
};
#undef STRING_INIT
Meanwhile IDX_KEYNAME_TAB doesn't do anything, as TAB and K_TAB have the
same name.
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Allow trailing backslashes in option values.
- Match :map-special modifier.
- Match :map-arguments case-sensitively.
- Remove <*Leader> from map modifier list and allow in RHS of a mapping.
closes: #16822
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: too many strlen() calls in misc2.c
Solution: refactor misc2.c and use bsearch() instead of a linear search
to find matches in the key_names_table array (John Marriott).
This commit changes misc2.c to use bsearch() to perform string searches of
the key_names_table array.
Implementation detail:
- Some entries in this array have alternate names. Add field alt_name to
point to the alternate name.
- Some entries in this array are only available if a given feature is
defined. Keep them in the array, but add a boolean field enabled to
indicate if the record can be used or not. If the feature is not
available, the corresponding enabled field is set to FALSE.
In my measurements running the test suite on a huge non-gui build on
linux, the number of string comparisons in get_special_key_code():
Before (linear search): 2,214,957
After (binary search): 297,770
A side effect of this is 1477 calls to STRLEN() in
get_special_key_name() for the same test run are no longer necessary.
While we are here, refactor call_shell() and the mshape_names array to
remove some STRLEN() calls.
closes: #16788
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: not possible to generate completion candidates using fuzzy
matching
Solution: add the 'completefuzzycollect' option for (some) ins-completion
modes (glepnir)
fixes#15296fixes#15295fixes#15294closes: #16032
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: wrong indentation of lastline when expanding multiple lines
Solution: Check OPENLINE_FORCE_INDENT flag in open_line() (glepnir)
closes: #16786
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
When a syntax file is changed, timestamps of the corresponding files are
updated.
NOTE: At the moment this script does not strictly track dependency, like
cpp on c.
Also update ignore files
closes#16548
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
I tried to figure out what was the most common using modelines. Note
that there are 2401 vim files, and the numbers in the other command
outputs below add up to significantly less than that, so it's possible
that my estimate of what's most common is way off.
```
$ find . -name \*.vim | wc -l
2401
```
It looks like 2 is the most common value by far for shiftwidth and
softtabstop, so I used that for indent_size.
```
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(sw|shiftwidth)=[0-9]+' | cut -d = -f 2 |
> sort | uniq -c | sort -n
2 0
14 3
18 8
75 4
610 2
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(sts|softtabstop)=[^ :]+' | cut -d = -f 2 |
> sort | uniq -c | sort -n
2 -1
7 8
9 0
9 3
43 4
469 2
```
Similarly, 8 is by far the most common tabstop, so I didn't adjust that.
```
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(ts|tabstop)=[0-9]+' | cut -d = -f 2 |
> sort | uniq -c | sort -n
1 20
1 6
1 9
2 10
2 16
2 17
3 15
4 3
5 18
9 2
40 4
497 8
```
And expandtab is significantly more common than noexpandtab. Taking that
in combination with the common shiftwidth and softtabstop of 2 but
tabstop of 8, I set indent_style to space.
```
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(no)?(et|expandtab)\>' | sort | uniq -c | sort -n
15 noexpandtab
86 noet
115 et
309 expandtab
```
I did try to look at a few of the less common values for those options
to see if there was any obvious pattern, like all *.vim files in one
directory having a different setting. The only real pattern I noticed
was in runtime/pack/dist/opt/netrw, but that looks like it's imported
from a separate repository? So I think it might make more sense for them
to create their own .editorconfig file rather than putting settings for
that directory in this one.
closes: #16777
Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Vim9 syntax changed before Vim 9 leading to errors thrown if checked for
availability of Vim9script in Vim Version 8.2 such as
This check seems to work as well and throws less errors on Vim 8.2 such
as on Ubuntu 22.04
closes: #16783
Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Without this change, pressing K while in one manpage to load another
one, then pressing CTRL-O to go back, results in going to the bottom of
the current (second) manpage. With this change, it goes back to the
previous manpage.
closes: #16791
Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
see :help E499 and :h key-notation
closes: #16795
Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: when the file 'TestCommand?Test' exists,
'Test_complete_cmdline()' will fail when writing the file. And
there's no related cleaning operation for this kind of file
before the test run.
Solution: modify `write` to `write!` to override (Jim Zhou).
closes: #16799
Signed-off-by: Jim Zhou <jimzhouzzy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: ABNF files are not detected
Solution: detect '.abnf' file as abnf filetype and
include an abnf syntax plugin (A4-Tacks).
References:
- RFC5234
- RFC7405
closes: #16802
Signed-off-by: A4-Tacks <wdsjxhno1001@163.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: heap-buffer-overflow with 'nostartofline' and Ex command in
tag file.
Solution: Set cursor column when moving cursor to line 1 (zeertzjq).
closes: #16796
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: wildmenu highlighting in popup can be improved
Solution: Check if the completion items contain submatches of the
entered text (Girish Palya).
This update enables highlighting in the popup menu even when the matched
fragment or pattern appears within an item (string) rather than only at the
beginning. This is especially useful for custom completion, where menu items
may not always start with the typed pattern.
For specific use cases, refer to the two examples in
https://github.com/vim/vim/pull/16759
A sliding window approach is used with direct string comparison. Performance
is not a concern, as highlighting is applied only to displayed lines, even if
the menu list is arbitrarily long.
closes: #16785
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>