11320 Commits
Author SHA1 Message Date
Justin M. Keyes b107154ba2 docs: misc, cwd, vimscript.txt #41356
Extract vimscript.txt from repeat.txt
2026-08-17 13:37:08 -04:00
Rob Pilling a4aa0417cf feat(ui2): drop default enter-pager-via-CR mapping #40993 2026-08-17 08:03:29 -04:00
Justin M. Keyes 581ce0b3da fix(cmdatom): <Cmd> mappings #41347
Problem:
`<cmd>` mappings do not emit `CmdAtom.text`.
`<cmd>` and Lua-callback mappings that edit the buffer apply only at the
primary cursor, not cascaded (multicursor).

Solution:
Capture the `<cmd>` command in getcmdkeycmd().
Add kKeyOpaque ("no capturable keys"); narrow kKeySynthetic ("not
a keystroke") to K_EVENT/K_IGNORE, so an opaque mapping's edit still
sets `map_edit` and cascades via LHS-replay.
2026-08-16 18:00:55 -04:00
Willaaaaaaa e0e2f978a0 feat(vim.fs): slug() supports URI #41241
Problem:
`vim.fs.slug()` does not handle URIs like `term://foo//123:bash`,
so callers (e.g. terminal persistence) must strip the scheme before
calling `slug()`.

Solution:
Detect `scheme://` from the raw input before `normalize()` and
replace it with a `=uri-<scheme>-` prefix.
2026-08-16 13:29:34 -04:00
zeertzjq 2edb1c0009 fix(lua): don't limit indexed vim.cmd positional argument count (#41317) 2026-08-16 07:25:04 +08:00
Justin M. Keyes 37c670e682 fix(marks): undo reverts a mark set after the change #41330
Problem:
A named mark updated after a change is moved back (treated as the
original mark) by undo:

    :1mark d
    :$
    dw
    :2mark d   " 'd is on line 2
    :undo      " 'd is back on line 1

The undo header snapshots `b_namedm` when the change is recorded, and
`u_undoredo()` restores that snapshot indiscriminately.

Solution:
Update the pending header's snapshot when a mark is set explicitly.
Marks that the change itself moved go through mark_adjust(), not
setmark_pos(), so those are still reverted.

Similar to 2546741d1b (for extmarks): an explicit set inside an undo
block is confused with an edit-driven adjustment. But the extmarks case
is dealing with mid-edit moves, whereas named/regular marks only need
the stale snapshot dropped.
2026-08-15 13:34:51 -04:00
Christian Clason 1c9002a70e build(deps): bump tree-sitter-diff to v0.2.0 2026-08-14 19:12:05 +02:00
Barrett Ruth 0af3b9827b feat(dir): user can sort/filter listings, DirReadPost event #41138
Problem:
Directory listing entries cannot be customized (filtered, reordered).
Listings are read by a BufReadCmd, which suppresses BufReadPost, so they
are the only buffers with no post-read event to hook.

Solution:
Introduce a post-render User autocmd `DirReadPost`, marking the dir
buffer writable for the duration and before the cursor is placed, so
handlers can sort or filter it with ordinary commands. Document common
recipes
2026-08-14 12:25:31 -04:00
Justin M. Keyes 64a301184e feat(input)!: CmdAtom event #41297
Problem:
There is no unified notion of a "user action".

Vim processes input by one-char-at-a-time, and mostly throws away any
hints it might gather about the user's action, with one exception: it
stores the last _edit_ action (the "redo buffer", encoded as
unstructured `["x][v][count]body` bytes).

Plugins can only observe individual keys (vim.on_key) and high-level
effects (TextChanged, CursorMoved).

Solution:
- Users can subscribe to `CmdAtom` events to handle any user action.
  - Event is deferred; handlers cannot cancel or interfere with user
    actions.
- Capture `CmdSpec` from the normal/insert/visual subsystems.
  - typeahead/readahead stay unstructured (`buffheader_T`): they are key
    streams, not commands.
  - the redo/record buffers become `StringBuilder`: fewer
    allocations/copies.
- Repurpose the input/redo engine to accept `CmdSpec` objects.

"atom": one repeatable unit of user input, as a resolved (post-mapping)
keysequence plus structured fields. Only user actions, not `:normal`,
API calls, or non-"t" `feedkeys`.

BREAKING: dot-repeat of an Insert session, replays the entire session
including cursor-moves (:help ins-repeat).

BREAKING: dot-repeat of a Visual operation, replays the selection
instead of operating on a fixed-size region.
2026-08-14 09:30:31 -04:00
zeertzjqandAliaksei Budavei 24183950e1 vim-patch:5d41506: runtime(sh): Selectively suppress matching syntax errors (#41302)
As a refinement upon "g:sh_no_error", support not matching
particular classes of syntax errors.  Look up syntax rule
names and list them with:
‐-----------------------------------------------------------
let g:sh_no_error_rules = ["shCurlyError", "shParenError"]
‐-----------------------------------------------------------

closes: vim/vim#20935

https://github.com/vim/vim/commit/5d41506eb4895fbf0b6ccf4067c7f6e3c8ac568b

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2026-08-14 08:47:30 +08:00
zeertzjqandFionn Fitzmaurice 1a9467ab44 vim-patch:9.2.0957: filetype: ArgoCD config file is not recognized (#41301)
Problem:  filetype: ArgoCD configuration file is not recognized
Solution: Detect */argocd/config as yaml filetype (Fionn Fitzmaurice).

Reference:
https://argo-cd.readthedocs.io/en/latest/user-guide/commands/argocd_configure/#options-inherited-from-parent-commands

closes: vim/vim#21031

https://github.com/vim/vim/commit/7807dd22793da0e826618c0ca9c6210bbc1ea3f5

Co-authored-by: Fionn Fitzmaurice <git@fionn.computer>
2026-08-14 08:47:14 +08:00
zeertzjqandEmilien Breton ca88ad10c8 vim-patch:e402d1c: runtime(doc): improve documentation for |v_gF| (#41300)
https://github.com/vim/vim/commit/e402d1c443ec9f542df0503d765a09c32eabd7b4

Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2026-08-14 07:46:52 +08:00
Nathan B. faf8345eef fix(diagnostic): don't accumulate BufRead autocmds for unloaded buffers #40869
Problem:
vim.diagnostic.set() defers extmark position computation for an
unloaded buffer via a once=true BufRead autocmd, registering a new one
on every call without replacing the previous one. Each pending autocmd
also retains that call's diagnostics.

Solution:
Instead of registering an autocmd per set() call, register a single
static BufRead autocmd that computes positions from the diagnostic
cache for any buffer with cached diagnostics when it is read. This
removes the per-call registration entirely (nothing left to
accumulate) and means diagnostics cleared while the buffer was
unloaded no longer produce stale extmarks.
2026-08-13 09:17:16 -04:00
Justin M. Keyes a1ea2f35be Merge #41075 from echasnovski/pack-packspec-part1 2026-08-13 08:53:49 -04:00
zeertzjqandDoug Kearns e8a1addb5a vim-patch:90a9a8c: runtime(algol68): Update syntax, fix syncing (#41291)
Use "fromstart" syncing.

Pragment regions are delimited by shared start/end tokens which render
other syncing types largely useless.  A sync point located in the middle
of a multiline comment cannot distinguish the end token from a start
token and the erroneously created region runs to EOF.

closes: vim/vim#21032

https://github.com/vim/vim/commit/90a9a8c7523741f4a9cd091a0f1727902e8c9340

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-13 08:27:50 +08:00
zeertzjqandChristian Brabandt ecaf9e9396 vim-patch:02bf089: runtime(doc): clarify diff_filler() function (#41283)
fixes: vim/vim#20990

https://github.com/vim/vim/commit/02bf0893d536449548f91b75817748a5e25219c0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-08-12 08:24:48 +08:00
Nathan Zeng 4a3197f2ad refactor(defaults): edit global cwd on "1-" #41254
Problem:
`1-` does nothing from a directory buffer, because we are already in the
buffer-local CWD. It's also unintuitive that this mapping behaves
differently based on the resolved CWD.

Solution:
Have `1-` open the global CWD.
2026-08-11 04:08:33 -04:00
zeertzjqandDoug Kearns 5bc08dbb46 vim-patch:6163d99: runtime(doc): Improve :help expr-number, mention unary +/- (#41267)
- Mention unary +/- use in both integer and floating-point descriptions.
- Add "0b" binary prefix tag to match existing "0o" and "0x" tags.

closes: vim/vim#20997

https://github.com/vim/vim/commit/6163d99a32a559e0a5387989f09c43c7870c249f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-11 10:19:38 +08:00
zeertzjqandJosef Schönberger 5f15c0e959 vim-patch:2e8c81e: runtime(strace): highlight stack trace as comment (#41266)
strace supports printing a complete stack trace for each syscall using
the `-k` (`--stack-trace`) flag. Highlight the trace as a comment.

closes: vim/vim#20998

https://github.com/vim/vim/commit/2e8c81ea093ca84fa8402cb140422d5338bbb6d9

Co-authored-by: Josef Schönberger <josef.schoenberger@tum.de>
2026-08-11 01:30:08 +00:00
Kyle 8d406ed2ac fix(defaults): emit events on automatic background change #41242
Problem:
After #40270, events are no longer emitted from the automatic background
detection. This applies not just during startup, but also if the user
manually changes the background of their terminal.

Solution:
Set the background as normal, assuming that a normal terminal will
respond within 100 ms. Change test to match expected behavior:
- BG set during startup won't trigger user autocmds since it runs before
  any user config
- If the terminal takes longer than 100 ms to respond to initial OSC 11,
  it does trigger the OptionSet, but it is triggered through the normal
  path to ensure values like v:option_new are set #38551
- BG change after startup still triggers autocmds #41146
2026-08-10 04:17:51 -04:00
Torben Leth f538a4f16f vim-patch:9.2.0926: filetype: Business Central files are not recognized (#41230)
Problem:  filetype: Business Central files are not recognized
Solution: Add filetype detection logic for *.al files to detect perl or
          use either perl or al filetype (Torben Leth).

Reference:
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-dev-overview

closes: vim/vim#20975

Supported by AI.

https://github.com/vim/vim/commit/9b41cf6386bc0afd1bf5eca396adfdd488e617d0
2026-08-09 00:49:20 +00:00
zeertzjqandDoug Kearns 10aa1c975f vim-patch:a33e5da: runtime(doc): Improve :help expr-number
closes: vim/vim#20956

https://github.com/vim/vim/commit/a33e5da9f55a00fbfaef1ec2476fe0dd0758ac1d

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-09 08:00:12 +08:00
zeertzjqandBogdan Barbu 05acaa8330 vim-patch:e0b8113: runtime(doc): DocBook syntax variable scopes are not clearly documented
Problem:  DocBook syntax variable scopes of docbk_type and docbk_ver
          are not clearly documented: docbk_type uses the wrong scope
          (it should be buffer-local) and docbk_ver also has an
          undocumented buffer-local version.
Solution: Correct the docbk_type examples and describe the docbk_ver
          precedence.

closes: vim/vim#20977

https://github.com/vim/vim/commit/e0b81136c76a5ab2203eb6f6ece0225f2565e42e

Co-authored-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
2026-08-09 08:00:11 +08:00
zeertzjqandRochish Manda 318d6a7f59 vim-patch:2c0318d: runtime(doc): fix typo in netrw help file (#41228)
closes: vim/vim#20968

https://github.com/vim/vim/commit/2c0318d2854418d26032352ab1152b598642e38a

Co-authored-by: Rochish Manda <28740792+Rochish-Manda@users.noreply.github.com>
2026-08-08 09:26:00 +08:00
Justin M. Keyes 33a688f9fe fix(messages): dangling progress-messages #41222
Problem:
Some builtin features emit progress-messages which never "complete".
- On failure, `:write` does not complete the progress-msg it started.
- ins-completion never ends its "Scanning..." message.

Solution:
- `buf_write()` emits "failed" status on failure.
- `ins_compl_stop()` ends the completion one.
2026-08-07 16:10:02 -04:00
Mike J McGuirk fe3aa64945 feat(lsp): pass target buffer to reuse_client predicate #41163
Problem: The reuse_client predicate does not pass the target buffer,
preventing decisions from being truly made per buffer.

Solution: Pass the target buffer.
2026-08-07 11:27:19 -04:00
Justin M. Keyes 2e0a5a596a fix(terminal): spawn in effective CWD #41211
Problem:
`:terminal` does not respect the invocation-time CWD.
This wasn't noticeable with `:lcd` because the window-local CWD gets
applied to the new terminal buffer. But it is noticeable with `:bcd`.

Solution:
Specify `cwd` in the job spec.
2026-08-07 07:44:19 -04:00
Justin M. Keyes a4a544032a feat(cwd)!: :lcd! (bang), rearrange :bcd/:lcd/… scope precedence #41194
Problem:
- buf-local CWD scope is lower priority than :lcd, which is weird.
  ```
  win > buf > tab > global
  ```
- No way to clear current CWD at a given scope.

Solution:
- Rerrange scope precedence to:
  ```
  buf > win > tab > global
  ```
- Introduce "bang" variants (`:bcd!`/`:lcd!`/`:tcd!`) which clears the
  local CWD for the given scope.
2026-08-07 04:41:37 -04:00
zeertzjqandBogdan Barbu 9c738cb718 vim-patch:9.2.0920: filetype: json-ld files are not recognized
Problem:  filetype: json-ld files are not recognized
Solution: Detect *.jsonld files as jsonld filetype, include
          filetype, indent and syntax plugins (Bogdan Barbu).

Reference:
https://www.w3.org/TR/json-ld11/

closes: vim/vim#20954

https://github.com/vim/vim/commit/a1e2198a2ca8bbddcad69ade8629f371bcb4cf1f

Co-authored-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
2026-08-07 12:36:41 +08:00
zeertzjqandAliaksei Budavei 925ddb190f vim-patch:90e8cb0: runtime(sh): Fix shFunctionTwo and shFunctionFour definitions for Bash
Claim e.g. "function f () { :; }" as shFunctionTwo while
observing that parentheses after the function name are
optional when the "function" word is used and do not delimit
its body if the latter follows them in "{}" (which should
not be taken for granted with limited backtracking).

closes: vim/vim#20878

https://github.com/vim/vim/commit/90e8cb0094508e9e6932adcf42f5003251c47c26

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2026-08-07 12:35:04 +08:00
ba823836cf vim-patch:bfc7604: runtime(sh): Do not conflate comments and function declarations in Bash
Bash identifiers declared in scripts cannot have a leading
"#" in their names.  And neither "namespace" nor "function"
can be followed by a newline before an identifier.

related: vim/vim#20878

https://github.com/vim/vim/commit/bfc760467864846b5091c5c5768c53b97cc8b5a7

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Christoffer Aasted <dezzadk@gmail.com>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-07 12:34:54 +08:00
Justin M. Keyes eb19a52b7c feat(vim._with): keepcwd 2026-08-06 13:17:07 +02:00
Justin M. Keyes 1c1dc0558f feat(cwd): support explicit chdir (:bcd/:tcd/…) in temp context
Problem:
- Explicit `:bcd` (etc.) persists from `nvim_buf_call()` but not from an
  autocmd handler targeting a hidden buf (`LspAttach`, `TermRequest`, …),
  which needs a `vim.schedule()` workaround.
- `vim._with()` is supposed to work as a "sandbox", discarding
  side-effects, but it leaks CWD changes: `:lcd` from a `win` context,
  any chdir from a visible-buffer context.

Solution:
- Explicit :cd/:tcd/:bcd during a temp context persists by default.
  - "Ambient" directory changes ('autochdir', existing win-local CWD,
    etc.) are still undone, as before.
- Add `kCtxKeepDirs`: snapshot/restore the target's full CWD state
  (w/b/tp-local, global, cwd). Used by `vim._with()` and `'inccommand'`,
  which must not leak state.
2026-08-06 13:17:07 +02:00
Justin M. Keyes 9a93ac6533 refactor(vim.fs): slug() minor cleanup 2026-08-06 10:27:29 +02:00
Justin M. Keyes 7d2249c579 docs: misc, :bcd, slug() 2026-08-06 10:27:29 +02:00
Barrett Ruth 8b0f33a1ab feat(dir): set buffer-local CWD #41174 2026-08-06 03:39:53 -04:00
zeertzjqandBogdan Barbu 139ffd91de vim-patch:8c93e2d: runtime(make): variables in make target lists use wrong highlighting (#41183)
Problem:  Variables in make target lists are highlighted as targets when
          the prerequisite list is non-empty.
Solution: Match target lists separately from prerequisite regions so
          that contained identifiers are highlighted correctly.  Add
          regression test.

closes: vim/vim#20947

https://github.com/vim/vim/commit/8c93e2d50dacabcd66cc4cb9573da497e98d3c26

Co-authored-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
2026-08-06 08:06:25 +08:00
Olivia Kinnear 6107629c5b feat(fs): vim.fs.normalize{plain:boolean} #41127
`opts.plain=true` does not expand tildes in addition to environment
variables, unlike `opts.expand_env=false`.

`opts.expand_env=false` is soft-deprecated.
2026-08-05 16:11:13 -04:00
Justin M. Keyes ab80ea92cc fix(ui2): pager handling #41179
- Avoid shared state. Pass `focus` to set_pos()/expand_msg() instead of
  a shared `pager_focus` flag: the flag is only cleared when set_pos()
  actually enters the pager, so ":messages" from inside the pager left
  it set.
- pager_shown(): the pager window is invalid after leaving it with "q".
- Reuse pager_shown() in expand_msg().
2026-08-05 15:07:19 -04:00
Erdiansyah a29a9130a9 fix(ui2): do not steal focus when consecutive cmds emit messages #41062
Problem:  A message emitted while a previous expanded message is still
          visible opens the pager and enters it, moving focus away from
          the buffer window without an explicit request (#41061).
Solution: Only enter the pager when it was explicitly requested ("g<",
          :messages, or entered from the expanded cmdline). An unfocused
          pager is dismissed by the cmdline key handler, which stays armed
          across the cmdline and no longer dismisses on non-typed keys
          (#39221).
2026-08-05 14:07:59 -04:00
Oleh Kostiuk 23525dd4e3 fix(editorconfig): avoid trim_trailing_whitespace in insert-mode #41175
Problem:
During insert-mode / replace-mode, `autowrite` may trigger. If it does, the
cursor position can shift due to the automatic removal of trailing spaces on the
current line. When I resume typing, the space between the last word and the new
word is suddenly gone.

Solution:
Disable the "remove trailing spaces" handler during Insert (or a similar) mode.
Autosave logic is not affected.
2026-08-05 14:06:28 -04:00
Barrett Ruth 69664a0aca fix(zip): preserve alternate file #41178 2026-08-05 13:37:24 -04:00
Barrett Ruth 9127ed41a5 fix(dir): preserve alternate file #41177 2026-08-05 13:36:58 -04:00
zeertzjqandBogdan Barbu 743a8d448c vim-patch:5a1124e: runtime(c): compound literal braces are highlighted as errors
Problem: Braces in C compound literals and initializers inside parentheses
         and brackets are highlighted as errors.

Solution: Recognize those initializer blocks while preserving syntax recovery
          for malformed parentheses.

fixes:  vim/vim#18709
closes: vim/vim#20842

https://github.com/vim/vim/commit/5a1124e4f59fafa0c774db956ae1e86bdd259442

Co-authored-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
2026-08-05 07:02:22 +08:00
zeertzjqandChristian Brabandt e795115351 vim-patch:aeac948: runtime: Update Syntax Menus
Update makemenu.vim and re-generate synmenu.vim (using make menu).

closes:  vim/vim#20932
related: vim/vim#20930

https://github.com/vim/vim/commit/aeac948c6273076f666b473862af70e8b7e6c653

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-08-05 07:00:46 +08:00
zeertzjqandDoug Kearns 7fd2c868f7 vim-patch:f620c30: runtime(dart): Update compiler plugins
Use the unified dart command for all.

closes: vim/vim#20936

https://github.com/vim/vim/commit/f620c3001891e6f0abb1c97932af94d021c4e9a0

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-08-05 07:00:46 +08:00
Willaaaaaaa 7b03df5d54 feat(lua): vim.fs.slug() #41005
Problem:
Several subsystems need to derive a short, filesystem-safe identifier from an
arbitrary path, and each reinvents it ad-hoc:
- `'undodir'` and `swapfiles` encode the full path into a single filename, which
  may exceed filesystem length-limits.
- `:connect ssh://` needs the SSH ControlPath socket name to stay under the
  104-byte `sun_path` limit on macOS; today the path overflows it.
- the upcoming :terminal state dir.
- arbitrary plugin purposes.

Solution:
Provide `vim.fs.slug()`, which generates a bounded, one-way filename from an
arbitrary string. The input is normalized so equivalent paths produce the
same result. An 8-char hash is appended for uniqueness
2026-08-04 15:24:35 -04:00
Justin M. Keyes 9cd4dd1c19 fix(:bcd): do not "inherit" buffer-local dir
Problem:
Buffer-local CWD (:bcd) is "sticky", similar to window-local CWD (:lcd).
But this contradicts one of its main benefits: per-buffer "project root"
for LSP, OSC7.

Other problems:
- A buffer created with :edit/:enew/:new silently inherits b_localdir
  (and b_prevdir) from the previous buffer.
- curbuf_reusable() refuses to recycle a scratch buffer that has
  `b_localdir`.
- After :new/:vnew/:tabnew the CWD sticks to previous buffer's
  `b_localdir` even though the new curbuf has none, so :new is not
  equivalent to ":split | enew", and getcwd() disagrees with
  haslocaldir().
- Requires "which buffer spawned this buffer" semantics that no other
  buffer-local state has.

Solution:
Drop sticky/inherit behavior of buffer-local CWD (:bcd).

- do_ecmd: always apply the new curbuf's dir (`fix_current_dir`), like
  `do_autochdir` already does. :tabnew from a :bcd buffer now reverts to
  global CWD (and fires DirChanged), same as :tabnew from a :lcd window.
- curbuf_reusable(): recycling a scratch buffer frees its b_localdir.

To get sticky/inherit behavior of CWD, use `:lcd`.
2026-08-04 20:48:44 +02:00
Justin M. Keyes 46ca236525 fix(cwd): validate getcwd(…, -1) 2026-08-04 20:48:44 +02:00
Justin M. Keyes db2e86fba4 refactor(editor): cleanup change-directory (:bcd) logic 2026-08-04 20:48:05 +02:00