- 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: vim/vim#167273dca512939
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: tests: test_mksession does not consider XDG_CONFIG_HOME
Solution: allow to match $HOME/.vim/ and $HOME/.config/vim for &viewdir
(John M Devin)
closes: vim/vim#156395b9237c2e7
Co-authored-by: John M Devin <john.m.devin@gmail.com>
Problem: Amiga: default 'viewdir' may not work.
Solution: Use "home:" instead of "$VIM". Add a test. (Christian Brabandt,
closesvim/vim#12576)
b8b1c8ebd4
Cherry-pick Test_mkview_manual_fold() changes from 9.0.{0363,0626}.
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: chain complete does not work when 'cot' includes fuzzy
and 'completefuzzycollect' collects wrong next word.
(Konfekt)
Solution: compl_startpos is not set correctly, remove next word check
in search_for_fuzzy_match (glepnir).
fixesvim/vim#17131fixesvim/vim#16942closes: vim/vim#17136cfe502c575
Co-authored-by: glepnir <glephunter@gmail.com>
Problem:
`vim.lsp.buf.[implementation|definition|...]({ reuse_win = true })` does not
jump cursor to existing window if buffer is already open.
Steps to reproduce:
1. `nvim repro.lua`
2. Insert anything that lsp can read to open the library definition/implementation, e.g., `vim.keymap.set`
3. open `repro.lua` buffer and the library buffer side by side.
4. type `gd` over `set` to jump to the library definition.
The open buffer is scrolled to the target line, but cursor does not jump.
Solution:
Call nvim_set_current_win if necessary.
- Simplify usage:
- Instead of `nvim -l src/gen/gen_lsp.lua gen` now just
run `./src/gen/gen_lsp.lua`
- Removed `--methods` and `--capabilities` options.
- Improved rendering code in various areas.
This change modifies gen_lsp.lua so alias types are generated for
various types of lsp methods to distinguish between notifications
and requests:
- vim.lsp.protocol.Method.ServerToClient.Request
- vim.lsp.protocol.Method.ServerToClient.Notification
- vim.lsp.protocol.Method.ClientToServer.Request
- vim.lsp.protocol.Method.ClientToServer.Notification
These types are then used instead of `string` where appropriate.
Wrap the setting of basic whitespace formatting options in a conditional
block, following the de facto standard.
Setting 'et', 'sts' and 'sw' can be disabled by setting
"gleam_recommended_style" to false.
Follow up to PR vim/vim#17086.
closes: vim/vim#1712840daa1358c
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: tests: Test_backupskip() fails when HOME is defined
Solution: unset $HOME temporarily
ad503fe927
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Duplicate check for preinsert effect, particularly for Ctrl_w
and Ctrl_U.
Solution: Remove the specific check for Ctrl_w and Ctrl_U to eliminate
redundancy (glepnir).
closes: vim/vim#171291c2b258250
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: GNU extensions, such as `ifeq` and `wildcard` function, are
highlighted in BSDmakefile
Solution: detect BSD, GNU, or Microsoft implementation according to
filename, user-defined global variables, or file contents
closes: vim/vim#17089f35bd76b31
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Co-authored-by: Roland Hieber <rohieb@users.noreply.github.com>
Problem: tests: no test for 'pummaxwidth' with non-truncated "kind".
Solution: Add a test with "kind" and larger 'pummaxwidth' (zeertzjq).
closes: vim/vim#17126031919c7ac
Problem: Parts of the popup menu were rendered twice when the popup was
at maximum width because the truncation flag was being set too
liberally.
Solution: Make the truncation condition more precise by only setting it
when there's exactly one character of space remaining
(glepnir).
closes: vim/vim#1710832f2bb6e1e
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: not possible to configure the completion menu truncation
character
Solution: add the "trunc" suboption to the 'fillchars' setting to
configure the truncation indicator (glepnir).
closes: vim/vim#17006b87620466c
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: heap-buffer-overflow occurs with narrow 'pummaxwidth' value
(after v9.1.1250)
Solution: test that st_end points after st pointer (Hirohito Higashi)
closes: vim/vim#17005f13c856154
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem:
When a command is not found or not executable, the error message gives
no indication about what command was actually tried.
Solution:
Always append the command name to the error message.
BEFORE:
E5108: Error executing lua …/_system.lua:248: ENOENT: no such file or directory
AFTER:
E5108: Error executing lua …/_system.lua:249: ENOENT: no such file or directory: "foo"
fix#33445
Problem:
vim.uv.os_setenv gets "stuck" per-key. #32550
Caused by the internal `envmap` cache. #7920
:echo $FOO <-- prints nothing
:lua vim.uv.os_setenv("FOO", "bar")
:echo $FOO <-- prints bar (as expected)
:lua vim.uv.os_setenv("FOO", "fizz")
:echo $FOO <-- prints bar, still (not expected. Should be "fizz")
:lua vim.uv.os_unsetenv("FOO")
:echo $FOO <-- prints bar, still (not expected. Should be nothing)
:lua vim.uv.os_setenv("FOO", "buzz")
:echo $FOO <-- prints bar, still (not expected. Should be "buzz")
Solution:
- Remove the `envmap` cache.
- Callers to `os_getenv` must free the result.
- Update all call-sites.
- Introduce `os_getenv_noalloc`.
- Extend `os_env_exists()` the `nonempty` parameter.
Problem:
When doing paste operation mouse code tries to figure out it it is
dealing with a multi-line register by calling yank_register_mline(),
which fetches register data and checks its type. Later the code calls
either do_put() or insert_reg() which fetch register data again. This is
unnoticeable when working with internal neovim registers, but starts
hurting when dealing with clipboards, especially remote one (forwarded X
or socket tunnel or similar).
Solution:
Change yank_register_mline() to also return pointer to the
register structure prepared for pasting, and insert_reg() to accept
such register pointer and use it if it is supplied. do_put() already
has support for accepting a register structure to be used for pasting.
Fixes#33493
Problem:
mandoc warnings:
$ cd src/man
$ mandoc -Tlint -Wall nvim.1
mandoc: nvim.1:83:95: STYLE: input text line longer than 80 bytes: Remaining arguments ...
mandoc: nvim.1:251:8: WARNING: undefined escape, printing literally: \+
mandoc: nvim.1:283:46: WARNING: new sentence, new line
mandoc: nvim.1:330:115: STYLE: input text line longer than 80 bytes: When supplied with -...
mandoc: nvim.1:44:2: WARNING: skipping paragraph macro: Pp before Bl
mandoc: nvim.1:114:7: STYLE: no blank before trailing delimiter: Ic :w!
mandoc: nvim.1:313:12: STYLE: no blank before trailing delimiter: Ic :source!
Solution:
- wrap text lines (80 at maximum)
- new sentence, new line
- fix inconsistency in macro usage
see
- mandoc_char(7)
- mandoc_man(7)
- mandoc_mdoc(7)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Problem: During insert-mode completion, the most relevant match is often
the one closest to the cursor—frequently just above the current line.
However, both `<C-N>` and `<C-P>` tend to rank candidates from the
current buffer that appear above the cursor near the bottom of the
completion menu, rather than near the top. This ordering can feel
unintuitive, especially when `noselect` is active, as it doesn't
prioritize the most contextually relevant suggestions.
Solution: This change introduces a new sub-option value "nearest" for the
'completeopt' setting. When enabled, matches from the current buffer
are prioritized based on their proximity to the cursor position,
improving the relevance of suggestions during completion
(Girish Palya).
Key Details:
- Option: "nearest" added to 'completeopt'
- Applies to: Matches from the current buffer only
- Effect: Sorts completion candidates by their distance from the cursor
- Interaction with other options:
- Has no effect if the `fuzzy` option is also present
This feature is helpful especially when working within large buffers where
multiple similar matches may exist at different locations.
You can test this feature with auto-completion using the snippet below. Try it
in a large file like `vim/src/insexpand.c`, where you'll encounter many
potential matches. You'll notice that the popup menu now typically surfaces the
most relevant matches—those closest to the cursor—at the top. Sorting by
spatial proximity (i.e., contextual relevance) often produces more useful
matches than sorting purely by lexical distance ("fuzzy").
Another way to sort matches is by recency, using an LRU (Least Recently Used)
cache—essentially ranking candidates based on how recently they were used.
However, this is often overkill in practice, as spatial proximity (as provided
by the "nearest" option) is usually sufficient to surface the most relevant
matches.
```vim
set cot=menuone,popup,noselect,nearest inf
def SkipTextChangedIEvent(): string
# Suppress next event caused by <c-e> (or <c-n> when no matches found)
set eventignore+=TextChangedI
timer_start(1, (_) => {
set eventignore-=TextChangedI
})
return ''
enddef
autocmd TextChangedI * InsComplete()
def InsComplete()
if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
SkipTextChangedIEvent()
feedkeys("\<c-n>", "n")
endif
enddef
inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedIEvent()<cr><c-e>
inoremap <silent><expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <silent><expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
```
closes: vim/vim#17076b156588eb7
Co-authored-by: Girish Palya <girishji@gmail.com>
Problem: When switching to another window or tab page while the
completion menu is active, the menu stays visible, although it
belongs to the previous window/tab page context (Evgeni
Chasnovski).
Solution: Track the window and tab page where completion started. Detect
changes in the main editing loop and cancel completion mode if
the current window or tab page differs from where completion
started.
fixes: vim/vim#17090closes: vim/vim#17101cf7f01252f
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: missing out-of-memory check in linematch.c
Solution: return early in case of memory allocation failure, move the
pow() calculation ouside of the for() loop
(John Marriott)
closes: vim/vim#171182137710b43
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: When piping raw manpage content into `:Man!`, buf name is
set to 'man://.. ref', but the check only matches the prefix.
Allows duplicate buffers to be created, triggering E95.
Solution: Match full buf name instead of only 'man://' prefix.
If the buffer already exists, generate a unique name with
'man://' .. 'ref' .. '?new=' format.
Refs: #30132
Problem: Some parts of the tutor are outdated.
- For example, pressing `<Tab>` after typing `:e` does not complete the
command `:edit`, but shows a completion menu with the first entry being
`:earlier`.
closes: vim/vim#17107829eda7d38
Problem: Line number corrected for conceal_lines may be set beyond eob
when the last buffer line is concealed, causing ml_get errors.
Solution: Avoid setting line number beyond eob.
Problem: cursor_correct() calculates a valid cursor position which
is later changed by update_topline() and causes Ctrl-D
scrolling to be stuck (Daniel Steinberg, after v9.1.0258).
Solution: Update the valid cursor position before validating topline
(Luuk van Baal).
c98250377d
Problem: filetype: mbsyncrc files are not recognized
Solution: detect isyncrc and "*.mbsyncrc" files as mbsync filetype,
include filetype and syntax plugin (Pierrick Guillaume)
mbsync is a command line application which synchronizes mailboxes;
currently Maildir and IMAP4 mailboxes are supported.
New messages, message deletions and flag changes can be propagated both ways;
the operation set can be selected in a fine-grained manner.
References:
mbsync syntax overview: mbsync manual (isync v1.4.4)
https://isync.sourceforge.io/mbsync.html
Upstream support for the mbsync filetype.
Original plugin: https://github.com/Fymyte/mbsync.vimcloses: vim/vim#17103836b87d699
Co-authored-by: Pierrick Guillaume <pguillaume@fymyte.com>
Problem: define_function() is too long
Solution: refactor and split up into smaller functions
(Yegappan Lakshmanan)
closes: vim/vim#171053956c5b53c
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Computed buffer line for mouse position does not take into
account concealed lines on the reached row.
Solution: Adjust for concealed lines at the end of the loop computing
the buffer position.
Problem:
treesitter injected language ranges sometimes cross over the capture
boundaries when `@combined`.
Solution:
Clip child regions to not spill out of parent regions within
languagetree.lua, and only apply highlights within those regions in
highlighter.lua.
Co-authored-by: Cormac Relf <web@cormacrelf.net>
This has been bothering me quite for some time and I never knew why it
happened. Just today it occurred to me this might have been because of
the last-position-jump.
So I figured, let's fix it for everybody, not just me.
closes: vim/vim#170926f6c0dba9f
Co-authored-by: Christian Brabandt <cb@256bit.org>