Commit graph

1086 commits

Author SHA1 Message Date
Dino
c9fc5feb0e
vim: Make :bdelete use new workspace::CloseItemInAllPanes command (#48988)
Add workspace::CloseItemInAllPanes action that closes the active
item's buffer in every pane where it's open, matching Vim's `:bdelete`
semantics. Pane layout is preserved, only the buffer is removed.

`:bd` respects pinned tabs, `:bd!` overrides them and skips save.

Also refactors the tab switcher's close button to use the new
`close_items_with_project_path` method, removing duplicated logic.

Release Notes:

- Vim: `:bd` (`:bdelete`) now closes the file in all panes where it's
open
- Added `workspace::CloseItemInAllPanes` action to close a file across
all panes

Co-authored-by: David Baldwin <baldwindavid@gmail.com>
2026-02-12 12:33:51 +00:00
Richard Feldman
ee3f40fe25
Re-add MultiWorkspace (#48800)
Release Notes:

- Added agent panel restoration. Now restarting your editor won't cause
your thread to be forgotten.

---------

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
2026-02-12 01:06:23 +00:00
Mikayla Maki
83de8a25e0
Revert PRs for landing in main (#48969)
We're going to re-apply these after landing the multiworkspace branch.

Release Notes:

- N/A
2026-02-12 00:28:17 +00:00
Katie Geer
f233ae4c29
Add telemetry for user-facing notifications (#48558)
## Summary

Adds a "Notification Shown" telemetry event that fires whenever a
user-facing notification is displayed in Zed. This helps the team
understand error patterns, notification frequency, and which parts of
the application generate the most notifications.

## Event Schema

| Property | Type | Description |
|----------|------|-------------|
| `notification_type` | `string` | `"error"` or `"notification"` |
| `source` | `string` | Origin category (e.g., `lsp`, `git`, `settings`,
`editor`) |
| `lsp_name` | `string?` | Language server name (only for LSP
notifications) |
| `level` | `string?` | Severity: `"critical"`, `"warning"`, or `"info"`
|
| `has_actions` | `bool` | Whether the notification has action buttons |
| `notification_id` | `string` | Debug string of the NotificationId |
| `is_auto_dismissing` | `bool` | Whether the notification
auto-dismisses |

## NotificationSource Categories

A new `NotificationSource` enum categorizes notifications by origin:

- `lsp` - Language server notifications
- `settings` - Settings/keymap parse errors
- `update` - App updates, release notes
- `extension` - Extension suggestions/errors
- `git` - Git operations, commit errors
- `project` - Project-level issues
- `collab` - Collaboration notifications
- `remote` - SSH/remote project errors
- `file` - File access errors
- `editor` - Editor operations (search, encoding)
- `agent` - AI assistant notifications
- `cli` - CLI installation
- `system` - Generic fallback

## Privacy

**Message content is intentionally not included** in telemetry because:
- LSP messages come from external servers and may contain file paths or
error chains
- Error messages may contain sensitive paths or API-related information
- The metadata alone provides sufficient insight for error tracking

## Implementation

Updated function signatures to include `NotificationSource`:
- `show_notification(id, source, cx, build_fn)`
- `show_toast(toast, source, cx)`
- `show_error(err, source, cx)`
- `show_app_notification(id, source, cx, build_fn)`
- `notify_err(workspace, source, cx)`
- `notify_async_err(source, cx)`
- `notify_app_err(source, cx)`
- `detach_and_notify_err(source, window, cx)`

Release Notes

- N/A (internal telemetry change)

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-11 10:21:37 -08:00
Piotr Osiewicz
1176c39476
ci: Fix builds on Windows following mtime finnickery (#48878)
- **Revert "vim: Make `:bdelete` use new
`workspace::CloseItemInAllPanes` command (#48592)"**
- **Revert "linux: Forward env vars starting with ZED_ to flatpak-spawn
(#48118)"**
- **ci: Fix builds on hel1-windows-1**


- [x] Tests or screenshots needed?
- [x] Code Reviewed
- [x] Manual QA

Release Notes:

- N/A
2026-02-10 16:17:49 +01:00
David Baldwin
4911855194
vim: Make :bdelete use new workspace::CloseItemInAllPanes command (#48592)
Add `workspace::CloseItemInAllPanes` action that closes the active
item's buffer in every pane where it's open, matching Vim's `:bdelete`
semantics. Pane layout is preserved, only the buffer is removed.

`:bd` respects pinned tabs, `:bd!` overrides them and skips save.

Also refactors the tab switcher's close button to use the new
`close_items_with_project_path` method, removing duplicated logic.

Release Notes:

- Vim: `:bd` (`:bdelete`) now closes the file in all panes where it's
open
- Added `workspace::CloseItemInAllPanes` action to close a file across
all panes

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-02-10 14:32:24 +01:00
Dino
ad7b1f52b4
vim: Make end of line infallible (#48867)
When using `$` to move to the end of line (`vim::EndOfLine`), the
`vim::motion::Motion.move_point` method checks whether the new point,
that is, the point after the motion is applied is different from the
point that was passed as a method argument. If the point is not
different, the point and selection goals are only updated if
`vim::motion::Motion.infallible` returns true for the motion in
question.

In short, this means that, if the cursor was already at the end of the
line, and it got there using `vim::Right`, for example, the selection
goal wouldn't actually be set to
`SelectionGoal::HorizontalPosition(f64::INFINITY)`, so when the cursor
was moved to a shorter line, it wouldn't be set at the end of that line,
even though `$` had been used.

This commit updates `vim::motion::Motion.infallible` to ensure that, for
`vim::motion::Motion::EndOfLine`, it returns `true`, so that the
selection goal is always updated, regardless of whether the cursor is
already at the end of the line.

Closes #48855 

- [X] Tests or screenshots needed?
- [X] Code Reviewed
- [X] Manual QA

Release Notes:

- vim: Fixed `$` not sticking to end-of-line on vertical motions
(`j`/`k`) when the cursor was already at the end of the line via `l` or
arrow keys
2026-02-10 10:33:50 +00:00
Finn Evers
165b404460
Revert "New multi workspace (#47795)" (#48776)
Preparing this just in case.

Release Notes:

- N/A
2026-02-09 15:37:16 +01:00
Finn Evers
bdff8bf47c
Ensure proper workspace is used for various actions (#48767)
The multi workspace refactor **completely** broke the Vim mode, saving
is not possible, and various other actions. This PR fixes this

- [X] Code Reviewed
- [X] Manual QA

Release Notes:

- N/A
2026-02-09 10:33:36 +00:00
Mikayla Maki
1c21718587
New multi workspace (#47795)
It's happeningggggg

Release Notes:

- Changed the Agent Panel so that the Active Thread is restored on
restart.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Richard Feldman <richard@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-08 17:46:51 -08:00
Josh Robson Chase
c47430debf
helix: Fix line select with empty first line (#48026)
Release Notes:

- Fixed `HelixSelectLine` with an empty first line and a pre-existing
selection.

---------

Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
Co-authored-by: Lena Falk <lena@zed.dev>
2026-02-05 18:57:23 +01:00
lex00
2b5386b438
Fix vim increment/decrement on Markdown list markers (#47978)
`find_target()` failed to match numbers followed by a dot and a
non-digit (e.g. `1. item`), because the dot unconditionally reset
the scan state, discarding the number. Additionally, numbers at the
start of non-first lines were missed because the backward scan
stopped on the preceding newline and the forward scan immediately
broke on it.

Closes #47761

Release Notes:

- Fixed vim increment (`ctrl-a`) and decrement (`ctrl-x`) not working on Markdown ordered list markers like `1.`, `2.`, etc.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-02-04 23:52:43 +00:00
Dino
18a0103112
vim: Add $ and = as subword motion boundaries (#48276)
These changes update subword motions in order to also take `$` and `=`
into consideration as stopping punctuation, improving the subword
motions for certain languages where `$` and `=` are commonly used, like
PHP, for variables and assignments.

Closes #48267 

Release Notes:

- Improved Vim's subword motions to stop at `$` and `=` characters
2026-02-04 23:38:00 +00:00
Lukas Wirth
5d2feaa144
editor: Implement semantic highlighting (#46356)
Part of #7450

Big thanks to @macmv for pushing this forwards so much!

Rebased version of https://github.com/zed-industries/zed/pull/39539 as
working on an in-org branch simplifies a lot of things for us)

Release Notes:

- Added LSP semantic tokens highlighting support

---------

Co-authored-by: Neil Macneale V <neil.macneale.v@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-04 17:37:13 +00:00
Conrad Irwin
2539ac0263
vim: Revert changes to search (#48127) (#48234)
Release Notes:

- (nightly only) Fixed vim search to be regex by default
2026-02-03 02:46:41 +00:00
Xiaobo Liu
f0c165ac41
vim: Refactor vim search settings test (#48165)
Release Notes:

- N/A

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-02-02 16:24:37 +00:00
lex00
a4fe57d607
Fix vim method/comment navigation with expanded diff hunks (#47976)
Previously, `]m`/`[m` (method) and `]/`/`[/` (comment) motions would
navigate to incorrect positions when diff hunks were expanded. This was
caused by extracting raw `usize` values from `MultiBufferOffset` and
operating directly on the underlying buffer, which doesn't account for
expanded diff hunk content.

The fix properly uses `MultiBufferOffset` throughout and queries
`text_object_ranges` on the `MultiBufferSnapshot` instead of the
underlying buffer, ensuring correct coordinate mapping when diff content
is displayed inline.

Fixes #46612

Release Notes:

- Fixed vim method and comment navigation (`] m`, `[ m`, `] shift-m`, `[
shift-m`, `] /`, `[ /`) incorrectly positioning cursor when diff hunks
are expanded

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-02-02 13:49:28 +00:00
Xiaobo Liu
aafecf043a
vim: Respect search settings in buffer search (#48127)
Closes https://github.com/zed-industries/zed/issues/48007

Release Notes:

- Fixed Vim search not respecting `"search"` default settings

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2026-02-01 17:17:19 +02:00
Cole Miller
8d18b7b927
git: Fix desynced scrolling between LHS and RHS of side-by-side diff (#47913)
- Remove old attempt to sync scrolling
- Share a `ScrollAnchor` between the two sides, and be sure to resolve
it against the correct snapshot
- Allow either side to initiate an autoscroll request, and make sure
that request is processed in the same frame by the other side

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Jakub <jakub@zed.dev>
2026-01-31 18:33:22 +00:00
lex00
609e915b10
vim: Restore cursor position when dismissing buffer search (#47732)
Fixes #8048

## Summary

In vim mode, pressing Escape to dismiss the buffer search now correctly
restores the cursor to its original position, rather than leaving it at
the first match.

## Problem

When using vim's `/` command to search:
1. User positions cursor at line X
2. User presses `/` to open search, types a query
3. Matches are highlighted, cursor may visually jump to first match
4. User presses Escape to dismiss without navigating
5. **Bug:** Cursor ends up at first match instead of line X

This breaks vim parity where Escape should cancel the search and restore
cursor position.

## Solution

The fix leverages the `focused()` callback in `vim.rs`, which is called
when the editor regains focus after the search bar is dismissed.

**Key insight:** When search starts via `/`, the cursor position is
saved in `SearchState.prior_selections`. When search is *submitted* with
Enter, `search_submit()` drains these selections. But when search is
*dismissed* with Escape, they remain.

So in `focused()`, if:
- `prior_selections` is non-empty, AND
- The search bar's `is_dismissed()` returns true

...then we know the user dismissed the search (Escape) rather than
submitted it (Enter), and we restore the cursor.

## Why not handle `buffer_search::Dismiss` directly?

The initial approach tried to register a vim handler for the `Dismiss`
action. This didn't work because when Escape is pressed, the search bar
(which has focus) handles the `Cancel` action internally and calls its
`dismiss()` method directly—it doesn't dispatch `Dismiss` through the
action system. The vim handler registered on the editor was never
invoked.

## Test Plan

- Added `test_search_dismiss_restores_cursor` — verifies cursor
restoration when search is dismissed
- Added `test_search_dismiss_restores_cursor_no_matches` — verifies
behavior when query has no matches
- All 455 vim tests pass
- Manual testing confirms fix works with both `/` and `cmd-f`

## Release Notes

- Fixed vim mode: cursor now returns to original position when
dismissing buffer search with Escape (#8048)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 14:59:38 -07:00
Xin Zhao
05a021c4a3
docs: Correct action descriptions to reflect actual purpose (#46931)
Thanks @injust for pointing this out. It seems a few other action docs
were also copied from elsewhere and weren't updated to reflect their
actual purpose. This PR fixes those, though I may not have covered all
of them.

Closes #46832

Release Notes:

- N/A

---------

Co-authored-by: Kunall Banerjee <hey@kimchiii.space>
2026-01-28 23:10:25 +00:00
Ran Benita
41ce23f896
vim: Add gdefault setting to set /g as a default substitution flag (#47664)
Add support for Vim's `gdefault` option which makes the `:substitute`
command replace all matches in a line by default, instead of just the
first match. When enabled, the `/g` flag inverts this behavior.

- Add `vim.gdefault` setting
- Add `:set gdefault`, `:set nogdefault` (and short forms `:set gd`, `:set nogd`)
- Fix handling of multiple `/g` flags so that each one inverts the one before

Closes #36209

Release Notes:

- vim: Add `vim.gdefault` setting to make `/g` (replace all matches in a line) the default for substitutions, along with `:set gdefault` and `:set nogdefault` commands (short forms: `gd`, `nogd`)

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-27 17:04:10 +00:00
lex00
9ecafe1960
vim: Ensure paragraph motions use empty and not blank lines (#47734)
The `}` and `{` paragraph motions now correctly treat only truly empty
lines (zero characters) as paragraph boundaries, matching vim's
documented behavior. Whitespace-only lines are no longer treated as
boundaries.

Changed `start_of_paragraph()` and `end_of_paragraph()` in
`editor/src/movement.rs` to check `line_len() == 0` instead of
`is_line_blank()`.

Note: This change does NOT affect the `ap`/`ip` text objects. Per vim's
`:help ap`, those DO treat whitespace-only lines as boundaries, which is
the existing (correct) behavior in `vim/src/object.rs`.

Closes #36171

Release Notes:

- Fixed vim mode paragraph motions (`}` and `{`) to correctly ignore
whitespace-only lines

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-27 13:33:53 +00:00
everdrone
c93773cfe5
Make workspace::SendKeystrokes not use layout key equivalents (#47061)
Closes #46509

Release Notes:

- Fixed: `workspace::SendKeystrokes` would not allow remapping keys in
different keyboard layouts

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-01-27 03:28:00 +00:00
Josh Robson Chase
d1f7c249b6
helix: Fix normal-mode selection expansion during vim::Scroll commands (#47024)
Fixes the `vim::ScrollUp/Down` commands when a normal-mode vim or helix
selection exists.

Pretty straightforward: make the `scroll_editor` function aware of the
current vim/helix mode, and only expand the selection if a visual mode
is active.

Closes #47022

Release Notes:

- Fixed bug causing normal-mode vim/helix selections to get expanded
during `vim::Scroll` commands

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-26 19:54:02 +00:00
Piotr Osiewicz
515a840e76
build: Bump Rust version to 1.93 (#47358)
Release Notes:

- N/A

---------

Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2026-01-23 13:22:41 +01:00
MostlyK
d42fe0bba4
Fix Visual mode flip on project search (#44284)
Previously, when project search results first appeared, vim would
incorrectly switch to Visual mode. This happened because vim settings
(including `collapse_matches`) weren't synced to an editor until it
received focus. Since the results editor wasn't focused when the first
match was selected, the selection wasn't collapsed, causing vim to
interpret it as a visual selection.

Now vim settings are synced immediately when vim activates on an editor,
ensuring `collapse_matches` is set before any selections are made.

Closes #43878

Release Notes:

- Fixed vim mode incorrectly switching to Visual mode on first project
search

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-22 00:11:29 +00:00
Lukas Wirth
d092f3a41b
text: Speed up offset_for_anchor and fragment_id_for_anchor conversions (#46989)
And most importantly, speed `Anchor::cmp` by doing so.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-01-16 15:23:57 +00:00
Ben Kunkle
a2728e39a8
Split settings content into its own crate (#46845)
Closes #ISSUE

Moves the settings content definitions into their own crate, so that
they are compiled+cached separately from settings, primarily to avoid
recompiles due to changes in gpui. In that vain many gpui types such as
font weight/features, and `SharedString` were replaced in the content
crate, either with `*Content` types for font/modifier things, or
`String`/`Arc<str>` for `SharedString`. To make the conversions easy a
new trait method in the settings crate named `IntoGpui::into_gpui`
allows for `into()` like conversions to the gpui types in
`from_settings` impls.

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2026-01-15 18:10:21 +00:00
Lionel Henry
b5242ab5f2
vim: Fix subword motion near end of line (#45908)
Fixes subword motion incorrectly jumping to next line when near end of
line. Updates boundary detection to use exclusive boundaries with
need_next_char parameter, matching regular word motion behavior.
Refactors word and subword motion to share boundary detection logic.

Closes #17780

Release Notes:

- Fixed subword motion incorrectly jumping to the next line when near
the end of a line

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-14 10:55:15 +00:00
everdrone
5be4b60176
Customizable vim mode text color (#46639)
Release Notes:
- Added ability to customize vim mode foreground

---

<video
src="https://github.com/user-attachments/assets/776ecfcd-9600-4a04-b3cf-e78af439aab2"
/>
2026-01-13 15:38:13 -06:00
Ben Kunkle
eed80aaef6
settings_ui: Add vim settings (#46634)
Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-01-13 14:52:44 -05:00
Will Garrison
5a8a7d8666
vim: Change logic in subword motion subword_start calculation (#45341)
- Update subword boundary detection to stop at semantic punctuation
  (quotes, brackets, parens)
- Treat `.`, `-`, and `_` as subword separators for consistent behavior
- Extract `is_subword_start` and `is_subword_end` helpers for reuse in
  motion and object handling
- Add comprehensive tests for all subword motions matching vim's
  CamelCaseMotion behavior

Closes #23344

Release Notes:

- Fixed bug in Vim mode's subword motion punctuation handling

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-13 18:02:59 +00:00
AidanV
d2b31b47b6
vim: Allow trailing whitespace for :norm command (#46403)
Fix a bug with `:norm` that disallowed trailing whitespace.

Commands that accept generic args (defined with `args()`) now preserve
trailing whitespace, while commands that accept filenames (defined with
`filename()`) have whitespace pre-trimmed. This allows, for example, 
`:norm I  ` to correctly insert spaces, matching NeoVim's behavior.

Release Notes:

- vim: Fixed `:norm` command to preserve trailing whitespace in
arguments (e.g., `:norm I ` now correctly inserts two spaces)

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-13 14:13:15 +00:00
Conrad Irwin
bf87d0e6d1
Fix vim mouse selections (#45177)
Closes #27720

Release Notes:

- vim: Fixed selection drifting slowly to the right when selecting
chaotically with the mouse.
2026-01-09 20:34:45 +00:00
Hans
1062e2c5a9
vim: Add use_match_quotes setting for % motion, default is true (#42615)
Add a `match_quotes` parameter to the `vim::Matching` action that
controls whether the `%` motion should treat quote characters (', ", `)
as matching pairs.

In Neovim, `%` only matches bracket pairs (([{}])), not quotes. Zed's
existing behavior includes quote matching, which some users prefer. To
preserve backwards compatibility while allowing users to opt into
Neovim's behavior, this PR:

1. Adds an optional `match_quotes` boolean parameter to the
   `vim::Matching` action
2. Updates the default vim keymap to use ["vim::Matching", {
   "match_quotes": true }], preserving Zed's current behavior
3. Users who prefer Neovim's behavior can rebind `%` in their keymap:

```
{
    "context": "VimControl && !menu",
    "bindings": {
        "%": ["vim::Matching", { "match_quotes": false }]
    }
}
```

When `match_quotes` is `false`, the `%` motion will skip over quote
characters and only match brackets/parentheses, matching Neovim's
default behavior.

Release Notes:

- vim: Added match_quotes parameter to the vim::Matching action to control
whether % matches quote characters

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-09 18:04:44 +00:00
abdellah hariti
1fb2922be3
Vim search */# without moving cursor initially (#46244)
The default behavior for Vim search with `*` and `#` in normal mode is
to initiate a search and immediately jump to the next or previous match
respectively.

This behavior can be annoying, so Vim has many plugins to address this
specifically:

- [vim-asterisk](https://github.com/haya14busa/vim-asterisk)
-
[vim-SearchHighlighting](https://github.com/inkarkat/vim-SearchHighlighting)
- [vim-tranquille](https://github.com/RRethy/vim-tranquille)

This PR tries to emulate this behavior natively keeping up with Zed's
sane defaults and deviating from vanilla Vim when it makes sense.


Release Notes:

- Vim: `*` and `#` search doesn't jump immediately to next / previous
search.
2026-01-09 04:13:51 +00:00
Dino
00e3b2eb91
vim: Fix bug where repeat operator could lead to unrecoverable replaying state (#46376)
When a recorded action moves focus away from the editor (e.g.,
`buffer_search::Deploy`), the `EndRepeat` action handler is not invoked
because is node is no longer on the dispatch path. This left
`dot_replaying` set to `true`, causing subsequent repeats to malfunction
and the `VimGlobals.pre_count` value to never be reset.

Reset `dot_replaying` as a fail-safe when the replayer exhausts its
action queue, ensuring the state is always cleaned up regardless of
whether `EndRepeat` was handled.

Release Notes:

- Fixed vim repeat (`.`) breaking when the recorded action moves focus
away from the editor

Co-authored-by: neel <neel@chot.ai>
2026-01-08 16:41:19 +00:00
Rocky Shi
648d1de26b
vim: Implement text-based matching bracket logic for Vim '%' motion to correctly find pairs within comments (#45559)
Closes #25435

Release Notes:

- Improved vim's '%' motion to always fall back to text-based bracket
matching when language-aware matching fails
2026-01-08 16:35:30 +00:00
Dino
e0f445db8c
Enable test-support features for some dev dependencies (#46370)
The `vim` crate's tests depend on `git_ui`, which transitively depends
on `recent_projects` with `test-support` enabled. This causes
`recent_projects` to include RemoteConnectionOptions::Mock` variant
handling. However, `git_ui` was not enabling its `test-support` feature,
causing compilation failures when the Mock variant was expected but not
available.

This commit enables the `test-support` feature for both `git_ui` and
`title_bar` dev-dependencies in the `vim` crate, ensuring the Mock
variant is consistently available during testing.

Release Notes:

- N/A
2026-01-08 15:22:03 +00:00
Mikayla Maki
97c35c084b
gpui: Actually remove the Result from AsyncApp (#45809)
Depends on: https://github.com/zed-industries/zed/pull/45768

Refactor plan:
https://gist.github.com/mikayla-maki/6c4bf263fd80050715ba01f45478796e
Overall plan:
https://gist.github.com/mikayla-maki/7bb5078e4385a2e683e1e1eb40d17d38

This is the big one.

Release Notes:

- N/A

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:48:24 -08:00
Mayank Verma
b196831a8d
vim: Maintain end-of-line intent after $ with vertical motions (#45375)
Closes #45340

Release Notes:

- Fixed $ motion in vim mode to stay at end of the line when moving
vertically

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-06 18:01:39 +00:00
AidanV
c32abbdfb7
vim: Fix :g/pattern/norm commands applying on all matches (#43352)
Closes #36359

Release Notes:

- Fixes bug where `:g/pattern/norm commands` would only apply on the
last match

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-01-06 15:47:06 +00:00
Leon Qadirie
9a50bd4408
Add helix match surround operations (#44317)
Partially addresses #38151

Release Notes:

- Added Helix match surround operations
2026-01-06 15:42:13 +00:00
Mateo Kruk
4dd54c6742
vim: Fix word object count multiplier (2aw, 2iw) (#45686)
Closes #44251

## Context

Commands like `2daw` or `c2iw` were ignoring the count multiplier
because the word text object functions (`in_word`, `around_word`)
weren't using the `times` parameter. This fix propagates the count
through these functions so all operators correctly handle multiple
words.

## Before


https://github.com/user-attachments/assets/d5effa8a-4c04-4d70-a6b5-389cba730ca9

## After


https://github.com/user-attachments/assets/c50e4c0c-ea5c-4673-9c98-3d924b448025


Release Notes:

- Fixed vim mode count multiplier for word text objects (`2aw`, `2iw`,
`2aW`, `2iW`)
2026-01-05 09:13:25 -07:00
Yves Ineichen
3b626c8ac1
Allow empty splits on panes (#40245)
Draft as a base for continuing the discussion in #8008 : adds a
`SplitOperation` enum to support bindings like `["pane::SplitLeft",
{"operation": "Clear"}]`

To be discussed @MrSubidubi and others:

- Naming: Generally not happy with names yet and specifically `Empty` is
unclear, e.g., what does this mean for terminal panes? Added placeholder
code to split without cloning, but unsure what users would expect in
this case.
- ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them
for backwards compatibility?~~
- May have missed details in the move implementation. Will check the
code again for opportunities to refactor more code after we agree on the
approach.
- ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~

Closes #8008

Release Notes:

- Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow
creating an empty buffer.

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
Co-authored-by: MrSubidubi <finn@zed.dev>
2025-12-21 23:50:02 +00:00
AidanV
8001877df2
vim: Add :r[ead] [name] command (#45332)
This adds the following Vim commands: 
- `:r[ead] [name]`
- `:{range}r[ead] [name]`

The most important parts of this feature are outlined
[here](https://vimhelp.org/insert.txt.html#%3Ar).

The only intentional difference between this and Vim is that Vim only
allows `:read` (no filename) for buffers with a file attached. I am
allowing it for all buffers because I think that could be useful.

Release Notes:

- vim: Added the [`:r[ead] [name]` Vim
command](https://vimhelp.org/insert.txt.html#:read)

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2025-12-19 15:31:16 +00:00
Ben Kunkle
435d4c5f24
vim: Make vaf include const for arrow functions in JS/TS/TSX (#45327)
Closes #24264

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2025-12-18 21:56:47 -05:00
Ichimura Tomoo
81463223d5
Support opening and saving files with legacy encodings (#44819)
## Summary

Addresses #16965

This PR adds support for **opening and saving** files with legacy
encodings (non-UTF-8).
Previously, Zed failed to open files encoded in Shift-JIS, EUC-JP, Big5,
etc., displaying a "Could not open file" error screen. This PR
implements automatic encoding detection upon opening and ensures the
original encoding is preserved when saving.

## Implementation Details

1.  **Worktree (Loading)**:
* Updated `load_file` to use `chardetng` for automatic encoding
detection.
* Files are decoded to UTF-8 internal strings for editing, while
preserving the detected `Encoding` metadata.
2.  **Language / Buffer**:
* Added an `encoding` field to the `Buffer` struct to store the detected
encoding.
3.  **Worktree (Saving)**:
    * Updated `write_file` to accept the stored encoding.
    * **Performance Optimization**:
* **UTF-8 Path**: Uses the existing optimized `fs.save` (streaming
chunks directly from Rope), ensuring no performance regression for the
vast majority of files.
* **Legacy Encoding Path**: Implemented a fallback that converts the
Rope to a contiguous `String/Bytes` in memory, re-encodes it to the
target format (e.g., Shift-JIS), and writes it to disk.
* *Note*: This fallback involves memory allocation, but it is necessary
to support legacy encodings without refactoring the `fs` crate's
streaming interfaces.

## Changes

- `crates/worktree`:
    - Add dependencies: `encoding_rs`, `chardetng`.
    - Update `load_file` to detect encoding and decode content.
    - Update `write_file` to handle re-encoding on save.
- `crates/language`: Add `encoding` field and accessors to `Buffer`.
- `crates/project`: Pass encoding information between Worktree and
Buffer.
- `crates/vim`: Update `:w` command to use the new `write_file`
signature.

## Verification

I validated this manually using a Rust script to generate test files
with various encodings.

**Results:**

*  **Success (Opened & Saved correctly):**
    * **Japanese:** `Shift-JIS` (CP932), `EUC-JP`, `ISO-2022-JP`
    * **Chinese:** `Big5` (Traditional), `GBK/GB2312` (Simplified)
* **Western/Unicode:** `Windows-1252` (CP1252), `UTF-16LE`, `UTF-16BE`
* ⚠️ **limitations (Detection accuracy):**
* Some specific encodings like `KOI8-R` or generic `Latin1` (ISO-8859-1)
may partially display replacement characters (`?`) depending on the file
content length. This is a known limitation of the heuristic detection
library (`chardetng`) rather than the saving logic.


Release Notes:

- Added support for opening and saving files with legacy encodings
(Shift-JIS, Big5, etc.)

---------

Co-authored-by: CrazyboyQCD <53971641+CrazyboyQCD@users.noreply.github.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-12-17 19:46:17 +00:00
Dino
14958a47ed
vim: Attempt to fix flaky vim tests on windows (#45089)
Both `test_miniquotes_object` and `test_minibrackets_object` rely on
tree-sitter parsing for `MultiBufferSnapshot.bracket_ranges` to find
quote/bracket pairs. The `VimTestContext.set_state` call eventually
triggers async tree-sitter parsing, but `run_until_parked` doesn't
guarantee parsing completion.

We suspect this is what might be causing the flakiness on Windows, as
the syntax might not yet be parsed when the
`VimTestContext.simulate_keystrokes` call is made, so there's no bracket
pairs returned.

This commit adds an explicit await call on `Bufffer.parsing_idle` after
each `VimTestContext.set_state` call, to ensure tree-sitter parsing
completes before simulating keystrokes.

Release Notes:

- N/A
2025-12-17 10:31:36 +00:00