Problem: A pattern that matches the cursor position is bit complicated.
Solution: Use a dot to indicate the cursor line and column. (Christian
Brabandt, closesvim/vim#8497, closesvim/vim#8179)
04db26b360
Also use `n = ++vcol` in regexp_bt.c as `++vcol` alone fails lint.
helpers.source() was a hack to work around the lack of anonymous
:source. Its "create tempfile" behavior is not a required part of most
tests that use it.
Some tests still need the old "create tempfile" behavior either because
they test SID behavior, or because of missing nvim_exec features: #16071
Uses of `getline` in `filetype.lua` currently assume it always returns a
string. However, if the buffer is unloaded when filetype detection runs,
`getline` returns `nil`. Fixing this prevents errors when filetype
detection is run on unloaded buffers.
vim.tbl_get takes a table with subsequent string arguments (variadic) that
index into the table. If the value pointed to by the set of keys exists,
the function returns the value. If the set of keys does not exist, the
function returns nil.
The use of 'softtabstop' to set tabSize was introduced in 5d5b068,
replacing 'tabstop'. If we look past the name tabSize and at the actual
purpose of the field, it's the indentation width used when formatting.
This corresponds to the Vim option 'shiftwidth', not 'softtabstop'.
The latter has the comparatively mundane purpose of controlling what
happens when you hit the tab key (and even this is incomplete, as it
fails to account for 'smarttab').
s:EndTermDebug should only be called when exiting if the debugger started
without error, otherwise the plugin breaks.
Vim handles this by using job_setoptions to set the on_exit callback to
s:EndTermDebug after startup succeeds. However, Nvim does not have such
functionality; instead; use s:starting to mimic this behaviour.
Also, introduce s:running to fix s:CheckGdbRunning; it did not work correctly
due to the "[Process exited X]" message keeping the job's channel alive (though
the stream is closed). This means nvim_get_chan_info cannot be used to check if
the debugger has exited, as it may still return a non-empty dict.
Ref: #9342
Adds the option to have a single global statusline for the current window at the bottom of the screen instead of a statusline at the bottom of every window. Enabled by setting `laststatus = 3`.
Due to the fact that statuslines at the bottom of windows are removed when global statusline is enabled, horizontal separators are used instead to separate horizontal splits. The horizontal separator character is configurable through the`horiz` item in `'fillchars'`. Separator connector characters are also used to connect the horizontal and vertical separators together, which are also configurable through the `horizup`, `horizdown`, `vertleft`, `vertright` and `verthoriz` items in `fillchars`.
The window separators are highlighted using the `WinSeparator` highlight group, which supersedes `VertSplit` and is linked to `VertSplit` by default in order to maintain backwards compatibility.
Change missing provider plugins from errors to warnings for python and
perl. Also give proper advice under the ADVICE section instead of just
the errors.
Problem: Cannot jump to the last used tabpage.
Solution: Add g<Tab> and tabpagnr('#'). (Yegappan Lakshmanan, closes vim/vim#6661,
neovim #11626)
62a232506d
Nvim implemented this feature before Vim, but Vim made some useful changes (e.g:
beeping on failure). Port the changes to closer match Vim (also makes porting
future patches easier).
Also note that because CHECK_CMDWIN was added to goto_tabpage_tp, there is no
need to do the extra work with tabpage_index and goto_tabpage inside
goto_tabpage_lastused to fix cmdwin issues any more (#11692).
Note that while goto_tabpage_tp doesn't check for textlock like goto_tabpage
does, it shouldn't matter as it is already checked for earlier.
Add tags for <C-Tab> to tabpage.txt, and refer to <C-Tab> over CTRL-Tab to be
consistent with other docs like the patch.
Remove mention of "previous tabpage" (it can be confused with the tabpage to the
left, e.g: `:tabprevious`).
Similarly, don't rename old_curtab to last_tab in enter_tabpage (it might be
confused with the right-most tabpage, e.g: `:tablast`).
Cherry-pick Test_tabpage change from v8.2.0634.
92b83ccfda
Problem: Quickfix buffer shows up in list, can't get buffer number.
Solution: Make the quickfix buffer unlisted when the quickfix window is
closed. get the quickfix buffer number with getqflist().
(Yegappan Lakshmanan, closesvim/vim#4113)
647e24ba3d
Update runtime files.
a2baa73d1d
Cherry-pick tabpage.txt changes from patch 8.2.1413.
Skip digraph functions: included in #17440.
Skip many error codes as they haven't been ported yet.
Problem: Cannot execute a register containing line continuation.
Solution: Concatenate lines where needed. (Yegappan Lakshmanan,
closesvim/vim#6272)
856c1110c1
According to #2542 the "Future:" part was removed intentionally.
Use size_t in more places to reduce type casts.
* feat(api): `group` can be either string or int
This affects the following API functions:
- `vim.api.nvim_create_autocmd`
- `vim.api.nvim_get_autocmds`
- `vim.api.nvim_do_autocmd`
closes#17552
* refactor: add two maps for fast lookups
* fix: delete augroup info from id->name map
When in "stupid_legacy_mode", the value in name->id map would be updated
to `AUGROUP_DELETED`, but the entry would still remain in id->name. This
would create a problem in `augroup_name` function which would return the
name of the augroup instead of `--DELETED--`.
The id->name map is only used for fast loopup in `augroup_name` function
so there's no point in keeping the entry of deleted augroup in it.
Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
This enables retrieving autocommands defined in the given buffers. Under
the hood this simply translates the buffer numbers into '<buffer=%d>'
patterns.
This commit finishes support for colored and styled underlines adding
`CSI 4 : [2,4,5] m` support providing double, dashed, and dotted
underlines
Fixes#17362.
`:verbose` didn't work properly with lua configs (For example:
options or keymaps are set from lua, just say that they were set
from lua, doesn't say where they were set at.
This fixes that issue. Now `:verbose` will provide filename and line no
when option/keymap is set from lua.
Changes:
- compiles lua/vim/keymap.lua as vim/keymap.lua
- When souring a lua file current_sctx.sc_sid is set to SID_LUA
- Moved finding scripts SID out of `do_source()` to `get_current_script_id()`.
So it can be reused for lua files.
- Added new function `nlua_get_sctx` that extracts current lua scripts
name and line no with debug library. And creates a sctx for it.
NOTE: This function ignores C functions and blacklist which
currently contains only vim/_meta.lua so vim.o/opt wrappers aren't
targeted.
- Added function `nlua_set_sctx` that changes provided sctx to current
lua scripts sctx if a lua file is being executed.
- Added tests in tests/functional/lua/verbose_spec.lua
- add primary support for additional types (:autocmd, :function, :syntax) to lua verbose
Note: These can't yet be directly set from lua but once that's possible
:verbose should work for them hopefully :D
- add :verbose support for nvim_exec & nvim_command within lua
Currently auto commands/commands/functions ... can only be defined
by nvim_exec/nvim_command this adds support for them. Means if those
Are defined within lua with vim.cmd/nvim_exec :verbose will show their
location . Though note it'll show the line no on which nvim_exec call was made.
Works similar to ex <f-args>. It only splits the arguments if the
command has more than one posible argument. In cases were the command
can only have 1 argument opts.fargs = { opts.args }
Problem: Dtrace files are recognized as filetype D.
Solution: Add a pattern for Dtrace files. (Teubel György, closesvim/vim#9841)
Add some more testing.
4d56b971cb
Update runtime files
944697ae19
Doc changes:
Include remote_*() (even though +clientserver and remote.txt isn't ported yet)
Omit screenpos() (need v8.2.4389)
Other changes are N/A or cannot be directly applied
nvim_buf_get_text is the mirror of nvim_buf_set_text. It differs from
nvim_buf_get_lines in that it allows retrieving only portions of lines.
While this can typically be done easily enough by API clients,
implementing this function provides symmetry between the get/set
text/lines APIs, and also provides a nice convenience that saves API
clients the work of having to slice the result of nvim_buf_get_lines
themselves.
Closes https://github.com/neovim/neovim/issues/17456
* treesitter uses the default highlight priority of 50
* diagnostic highlights have a priority of 150
* lsp reference highlights have a priority of 200
This ensures proper ordering.
Problem: Cannot decide whether to skip test that fails with 64 bit ints.
(closesvim/vim#9072)
Solution: Add v:sizeofint, v:sizeoflong and v:sizeofpointer. Improve the
check for multiply overflow.
69b3072d98
Omit v:sizeof{int,long,pointer} as they're only really used for tests.
Problem: When reloading not all properties are detected.
Solution: Add the "edit" value to v:fcs_choice. (Rob Pilling, closesvim/vim#9579)
8196e94a8b
Cherry-pick some test changes from patch 8.1.1826.
Problem: Search() cannot skip over matches like searchpair() can.
Solution: Add an optional "skip" argument. (Christian Brabandt, closesvim/vim#861)
adc17a5f9d
Enable skip arg usage in autoload/freebasic.vim
evalarg_T doesn't really matter because it's deleted in v8.2.0918 (and
reincarnated for Vim9 script in v8.2.1047), but I found out too late :P Anyway:
- Port evalarg_T into eval.h and use const char * and Callback fields
- Use EVALARG_INIT to initialize
- Return bool over OK/FAIL from evalarg functions
- Remove check from evalarg_clean as callback_free ignores None callbacks anyway
- Move eva_buf field into evalarg_get as a local (not sure what reason it has
being in the struct)
N/A patches for version.c:
vim-patch:8.2.4355: unnecessary call to check_colorcolumn()
Problem: Unnecessary call to check_colorcolumn().
Solution: Remove the call. (Sean Dewar, closesvim/vim#9748)
0f7ff851cb
LSP server might return an item which would replace a token to another.
For example in typescript for a `jest.Mock` object `getProductsMock.`
text I get the following response:
```
{
commitCharacters = {
".",
",",
"("
},
data = {
entryNames = {
"Symbol"
},
file = "/foo/bar/baz.service.spec.ts",
line = 268,
offset = 17
},
filterText = ".Symbol",
kind = 6,
label = "Symbol",
sortText = "11",
textEdit = {
newText = "[Symbol]",
range = {
end = {
character = 16,
line = 267
},
start = {
character = 15,
line = 267
}
}
}
},
```
In `lsp.omnifunc` to get a `prefix` we call the `adjust_start_col` which
then returns the `textEdit.range.start.character`.
Th `prefix` then be the `.` character. Then when filter the items with
`remove_unmatch_completion_items`, every item will be filtered out,
since no completion word starts `.`.
To fix we return the `end.character`, which in that particular case will
be the position after the `.`.
In Nvim, like DirChanged, this also triggers when switching windows.
This marks Vim patch 8.2.4335 as ported.
vim-patch:8.2.4335: no autocommand event triggered before changing directory
Problem: No autocommand event triggered before changing directory. (Ronnie
Magatti)
Solution: Add DirChangedPre. (closesvim/vim#9721)
28e8f73ae2
Problem: Put in Visual mode cannot be repeated.
Solution: Use "P" to put without yanking the deleted text into the unnamed
register. (Shougo Matsushita, closesvim/vim#9591)
fb55207ed1
Cherry-pick get_y_previous() and set_y_previous() from patch 8.1.1736.
Nvim has removed y_current, so code related to it is N/A.
Problem: No support for end line number and column in 'errorformat'.
Solution: Add %e and %k. (closesvim/vim#9624)
e023d49937
Use "\t" to represent a Tab as it looks better.
Problem: Fuzzy matching doesn't give access to the scores.
Solution: Return the scores with a third list. (Yegappan Lakshmanan,
closesvim/vim#7596)
9d19e4f4ba
Remove seemingly useless NULL checks.
assert that removing the li one wasn't dumb.
Problem: Fuzzy matching does not support multiple words.
Solution: Add support for matching white space separated words. (Yegappan
Lakshmanan, closesvim/vim#7163)
8ded5b647a
Problem: Fuzzy matching only works on strings.
Solution: Support passing a dict. Add matchfuzzypos() to also get the match
positions. (Yegappan Lakshmanan, closesvim/vim#6947)
4f73b8e9cc
Also remove some N/A and seemingly useless NULL checks -- Nvim allocs can't
return NULL. I'm not sure why the retmatchpos stuff in match_fuzzy checks for
NULL too, given that Vim checks for NULL alloc in do_fuzzymatch; assert that the
li stuff is not NULL as that's the one check I'm ever-so-slightly unsure about.
Adjust tests. Note that the text_cb tests actually throw E6000 in Nvim, but we
also can't assert that error due to v8.2.1183 not being ported yet.
Problem: Cannot do fuzzy string matching.
Solution: Add matchfuzzy(). (Yegappan Lakshmanan, closesvim/vim#6932)
635414dd2f
Adjust Test_matchfuzzy's 2nd assert to expect the last error thrown, as
v8.2.1183 hasn't been ported yet (to be honest, the error message is kinda weird
if the 2nd argument is not convertible to string). We can still port this fully
as porting v8.2.1183 would require removing this change to pass CI.
Problem: Fnamemodify() does not apply ":~" when followed by ":.".
Solution: Don't let a failing ":." cause the ":~" to be skipped. (Yasuhiro
Matsumoto, closesvim/vim#5577)
d816cd94d8
Problem: pathshorten() only supports using one character.
Solution: Add an argument to control the length. (closesvim/vim#7006)
6a33ef0deb
Cherry-pick a line in test from patch 8.2.0634.
Use Nvim's config paths in docs.
shorten_dir() returning a pointer looks a bit confusing here, as it is
actually the same pointer passed to it, and it doesn't really reduce
much code, so change it back to void.
Assigning rettv->vval.v_string = NULL is not needed if a pointer is
within 64 bits. While this is usually the case, I'm not sure if it can
be taken for granted.
Problem: Not easy to get mark en cursor posotion by character count.
Solution: Add functions that use character index. (Yegappan Lakshmanan,
closesvim/vim#7648)
6f02b00bb0
Problem: A popup created with "cursorline" will ignore "firstline".
Solution: When both "cursorline" and "firstline" are present put the cursor
on "firstline". (closesvim/vim#7000) Add the "winid" argument to
getcurpos().
99ca9c4868
Skip popup window related code.
Cherry-pick all of Test_getcurpos_setpos() from patch 8.2.0610.
Problem: :for cannot loop over a string.
Solution: Accept a string argument and iterate over its characters.
74e54fcb44
v8.2.2659 is already ported.
N/A patches for version.c:
vim-patch:8.2.2736: Vim9: for loop over string is a bit slow
Problem: Vim9: for loop over string is a bit slow.
Solution: Avoid using strlen().
175a41c13f
Problem: Crash when using garbagecollect() in between rand().
Solution: Redesign the rand() and srand() implementation. (Yasuhiro
Matsumoto, closesvim/vim#5587, closesvim/vim#5588)
4f645c54ef
Omit test_srand_seed.
Unmacroify SHUFFLE_XOSHIRO128STARSTAR and SPLITMIX32 while we're at it (leave
ROTL alone as it's fairly innocent).
Problem: Random number generator in Vim script is slow.
Solution: Add rand() and srand(). (Yasuhiro Matsumoto, closesvim/vim#1277)
06b0b4bc27
Add missing method call usage to builtin.txt.
vim_time and test_settime is N/A.
Add a modeline to test_random.vim.
Use typval_T* over listitem_T* vars so we don't need to use TV_LIST_ITEM_TV all
over the place...
Remove NULL list checks (tv_list_len covers this).
Problem: Not easy to recognize the system Vim runs on.
Solution: Add more items to the features list. (Ozaki Kiichi, closesvim/vim#3855)
39536dd557
Some doc changes have already been applied. Some others are N/A.
"moon" was removed in patch 8.2.0427 so I did not add it.
Problem: Basic and form filetype detection is incomplete.
Solution: Add a separate function for .frm files. (Doug Kearns, closesvim/vim#9675)
c570e9cf68
Problem: No reduce() function.
Solution: Add a reduce() function. (closesvim/vim#5481)
85629985b7
Needs CHECK_LIST_MATERIALIZE from v8.2.0751 (and range_list_materialize from
8.2.0149).
Move e_reduceempty to funcs.c, as it's only used there. Make it static.
Use tv_blob_len, tv_list_len == 0 for empty checks.
Replace vim_memset(&funcexe, 0, ...) with FUNCEXE_INIT.
Leave li initially undefined (tv_list_first returns NULL if list is NULL).
This patch has a memory leak fixed by v8.2.0882.
Problem: The eval.txt help file is way too big.
Solution: Move the builtin function details to a separate file.
1cae5a0a03
Note: Neovim-specific references to |functions| were changed to
|builtin-functions|. This included updates to:
1. test/functional/vimscript/functions_spec.lua
2. test/functional/vimscript/eval_spec.lua
3. runtime/doc/lua.txt
These versions of python has reached End-of-life. getting rid
of python2 support removes a lot of logic to support two
incompatible python versions in the same version.
An extra backtick was explicitly written to show what a backtick looked
like, but it interferes with the syntax highlighting which thinks that
it's a part of a concealed group and couples it with the wrong backtick.
When trying to load a language parser, escape the value of
the language.
With language injection, the language might be picked up from the
buffer. If this value is erroneous it can cause `nvim_get_runtime_file`
to hard error.
E.g., the markdown expression `~~~{` will extract '{' as a language and
then try to get the parser using `parser/{*` as the pattern.