Related #4642
Compatible with #34136
Release Notes:
- Helix: `Shift+R` works as Paste instead of taking you to ReplaceMode
- Helix: `g .` goes to last modification place (similar to `. in vim)
**Summary**
Fixes#29134 - Visual mode cursor incorrectly jumps past empty lines
that contain inlay hints (type hints).
**Problem**
When in VIM visual mode, pressing j to move down from a longer line to
an empty line that contains an inlay hint would cause the cursor to skip
the empty line entirely and jump to the next line. This only occurred
when moving down (not up) and only in visual mode.
**Root Cause**
The issue was introduced by commit f9ee28db5e which added bias-based
navigation for handling multi-line inlay hints. When using Bias::Right
while moving down, the clipping logic would place the cursor past the
inlay hint, causing it to jump to the next line.
**Solution**
Added logic in up_down_buffer_rows to detect when clipping would place
the cursor within an inlay hint position. When detected, it uses the
buffer column position instead of the display column to avoid jumping
past the hint.
**Testing**
- Added comprehensive test case
test_visual_mode_with_inlay_hints_on_empty_line that reproduces the
exact scenario
- Manually verified the fix with the reproduction case from the issue
- All 356 tests pass with `cargo test -p vim`
**Release Notes:**
- Fixed VIM visual mode cursor jumping past empty lines with type hints
when navigating down
This change adds the ability to increment / decrement numbers that are
part of a visual selection. Previously Zed would resolve to the entire
number under visual selection for increment as oppposed to only
incrementing the part of the number that is selected
Release Notes:
- vim: Fixed increment/decrement in visual mode
This removes around 900 unnecessary clones, ranging from cloning a few
ints all the way to large data structures and images.
A lot of these were fixed using `cargo clippy --fix --workspace
--all-targets`, however it often breaks other lints and needs to be run
again. This was then followed up with some manual fixing.
I understand this is a large diff, but all the changes are pretty
trivial. Rust is doing some heavy lifting here for us. Once I get it up
to speed with main, I'd appreciate this getting merged rather sooner
than later.
Release Notes:
- N/A
There are two tests commented out in the helix file, but one of them
works again. I don't know if this is too little a change to be merged,
but I wanted to suggest it.
The other test might be more complicated though, so I didn't touch it.
Release Notes:
- N/A
In Vim mode, `ap` text object (used in `vap`, `dap`, `cap`) was
selecting multiple paragraphs when soft wrap was enabled. The bug was
caused by using DisplayRow coordinates for arithmetic instead of buffer
row coordinates in the paragraph boundary calculation.
Fix by converting to buffer coordinates before arithmetic, then back to
display coordinates for the final result.
Closes#35085
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
In vim and zed (vim and helix modes) typing "tx" will jump before the
next `x`, but typing it again won't do anything. But in helix the cursor
just jumps before the `x` after that. I added that in helix mode.
This also solves another small issue where the selection doesn't include
the first `x` after typing "fx" twice. And similarly after typing "Fx"
or "Tx" the selection should include the character that the motion
startet on.
Release Notes:
- helix: Fixed inconsistencies in the "f" and "t" motions
Related https://github.com/zed-industries/zed/issues/4642
Release Notes:
- Helix: without active selection, pressing `y` in helix mode will yank
a single character under cursor.
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
The Zed Plex fonts were found to violate the OFL by using the word Plex
in the name.
Lilex has better ligatures and box-drawing characters than Zed Plex
Mono, but Zed Plex Sans should be identical
to IBM Plex Sans.
Closes#15542Closeszed-industries/zed-fonts#31
Release Notes:
- The "Zed Plex Sans" and "Zed Plex Mono" fonts have been replaced with
"IBM Plex Sans" and "Lilex". The old names still work for backward
compatibility. Other than fixing line-drawing characters, and improving
the ligatures, there should be little visual change as the fonts are all
of the same family.
- Introduced ".ZedSans" and ".ZedMono" as aliases to allow us to easily
change the default fonts in the future. These currently default to "IBM
Plex Sans" and "Lilex" respectively.
Update both `:tabedit` and `:tabnew` commands in order to support a
single argument, a filename, that, when provided, ensures that the new
tab either opens an existing file or associates the new tab with the
filename, so that when saving the buffer's content, the file is created.
Relates to #21112
Release Notes:
- vim: Added support for filenames in both `:tabnew` and `:tabedit` commands
This was broken incidentally in
https://github.com/zed-industries/zed/pull/33417
A better fix would be to fix app shutdown to take control of the
executor so that we *can* run
foreground tasks; but that is a bit fiddly (draft #36015)
Release Notes:
- N/A
Closes https://github.com/zed-industries/zed/issues/33076
Release Notes:
- Fixed replace command on helix mode: now it actually replaces what was
selected and keeps the replaced text selected to better match helix
Closes#34763
Release Notes:
- Improved insert in `helix_mode` when a selection exists to better
match helix's behavior: collapse selection to avoid replacing it
- Improved append (`insert_after`) to better match helix's behavior:
move cursor to end of selection if it exists
Closes#21198
Release Notes:
- Adds support for `:norm`
- Allows for vim and zed style modified keys specified in issue
- Vim style <C-w> and zed style <ctrl-w>
- Differs from vim in how multi-line is handled
- vim is sequential
- zed is combinational (with multi-cursor)
Closes#34111
In Helix mode, the `;` key should collapse the current selection without
moving the cursor. I've added a new action `vim::HelixCollapseSelection`
to support this behavior.
https://github.com/user-attachments/assets/1a40821a-f56f-456e-9d37-532500bef17b
Release Notes:
- Added `;` key binding to collapse the current text selection in Helix
mode
This is following feedback from folks that were searching the "close
others" action, available in the tab's context menu, and not finding it
because it was actually named "close inactive", which was confusing. So,
this PR makes sure the tab's menu item and the action have consistent
naming.
Release Notes:
- Rename "CloseInactiveItems" action to "CloseOtherItems" for naming
consistency.
Follow up: #18634Closes#33328
Release Notes:
- Fixed language server shutdown process to prevent race conditions and
improper termination by waiting for shutdown confirmation before closing
connections.
This PR adds a `severity` argument so severity can be defined when
navigating through diagnostics. This allows keybinds like the following:
```json
{
"] e": ["editor::GoToDiagnostic", { "severity": "error" }],
"[ e": ["editor::GoToDiagnostic", { "severity": "error" }]
}
```
I've added test comments and a test. Let me know if there's anything
else you need!
Release Notes:
- Add `severity` argument to `editor::GoToDiagnostic`,
`editor::GoToPreviousDiagnostic`, `project_panel::SelectNextDiagnostic`
and `project_panel::SelectPrevDiagnostic` actions
Currently, the HelixDelete action switches to (vim) Normal mode instead
of HelixNormal mode. This adds a line to the helix delete action to stay
in helix normal mode.
There was already a commented-out test for this. I've uncommented it and
it now passes.
Release Notes:
- helix: Fixed switching to vim NORMAL mode instead of HELIX_NORMAL mode
after deletion
Closes#14760
Still TODO:
* Vim actually undoes *many* changes if they're all on the same line.
Release Notes:
- vim: Add `U` to return to the last changed line and undo
This Pull Request introduces various changes to the editor's horizontal
scrolling, mostly focused on vim mode's horizontal scroll motions (`z
l`, `z h`, `z shift-l`, `z shift-h`). In order to make it easier to
review, the logical changes have been split into different sections.
## Cursor Position Update
Changes introduced on https://github.com/zed-industries/zed/pull/32558
added both `z l` and `z h` to vim mode but it only scrolled the editor's
content, without changing the cursor position. This doesn't reflect the
actual behavior of those motions in vim, so these two commits tackled
that, ensuring that the cursor position is updated, only when the cursor
is on the left or right edges of the editor:
-
ea3b866a76
-
805f41a913
## Horizontal Autoscroll Fix
After introducing the cursor position update to both `z l` and `z h` it
was noted that there was a bug with using `z l`, followed by `0` and
then `z l` again, as on the second use `z l` the cursor would not be
updated. This would only happen on the first line in the editor, and it
was concluded that it was because the
`editor:📜:autoscroll::Editor.autoscroll_horizontally` method was
directly updating the scroll manager's anchor offset, instead of using
the `editor:📜:Editor.set_scroll_position_internal` method, like
is being done by the vertical autoscroll
(`editor:📜:autoscroll::Editor.autoscroll_vertically`).
This wouldn't update the scroll manager's anchor, which would still
think it was at `(0, 1)` so the cursor position would not be updated.
The changes in [this
commit](3957f02e18)
updated the horizontal autoscrolling method to also leverage
`set_scroll_position_internal`.
## Visible Column Count & Page Width Scroll Amount
The changes in
d83652c3ae
add a `visible_column_count` field to `editor:📜:ScrollManager`
struct, which allowed the introduction of the `ScrollAmount::PageWidth`
enum.
With these changes, two new actions are introduced,
`vim::normal:📜:HalfPageRight` and
`vim::normal:📜:HalfPageLeft` (in
7f344304d5),
which move the editor half page to the right and half page to the left,
as well as the cursor position, which have also been mapped to `z
shift-l` and `z shift-h`, respectively.
Closes#17219
Release Notes:
- Improved `z l` and `z h` to actually move the cursor position, similar
to vim's behavior
- Added `z shift-l` and `z shift-h` to scroll half of the page width's
to the right or to the left, respectively
---------
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
There were a couple of things preventing this from working:
- our hack to stop the node REPL from appearing broke in recent versions
of the JS DAP that started passing `--experimental-network-inspection`
by default
- we had lost the ability to create a debug terminal without specifying
a program
This PR fixes those issues. We also fixed environment variables from the
**runInTerminal** request not getting passed to the spawned program.
Release Notes:
- Debugger: Fix RunInTerminal not working for JavaScript debugger.
---------
Co-authored-by: Cole Miller <cole@zed.dev>
Closes #ISSUE
Adds a new `documentation` method to actions, that is extracted from doc
comments when using the `actions!` or derive macros.
Additionally, this PR adds doc comments to as many action definitions in
Zed as possible.
Release Notes:
- N/A *or* Added/Fixed/Improved ...
The major change in schemars 1.0 is that now schemas are represented as
plain json values instead of specialized datatypes. This allows for more
concise construction and manipulation.
This change also improves how settings schemas are generated. Each top
level settings type was being generated as a full root schema including
the definitions it references, and then these were merged. This meant
generating all shared definitions multiple times, and might have bugs in
cases where there are two types with the same names.
Now instead the schemar generator's `definitions` are built up as they
normally are and the `Settings` trait no longer has a special
`json_schema` method. To handle types that have schema that vary at
runtime (`FontFamilyName`, `ThemeName`, etc), values of
`ParameterizedJsonSchema` are collected by `inventory`, and the schema
definitions for these types are replaced.
To help check that this doesn't break anything, I tried to minimize the
overall [schema
diff](https://gist.github.com/mgsloan/1de549def20399d6f37943a3c1583ee7)
with some patches to make the order more consistent + schemas also
sorted with `jq -S .`. A skim of the diff shows that the diffs come
from:
* `enum: ["value"]` turning into `const: "value"`
* Differences in handling of newlines for "description"
* Schemas for generic types no longer including the parameter name, now
all disambiguation is with numeric suffixes
* Enums now using `oneOf` instead of `anyOf`.
Release Notes:
- N/A
Closes#32397
This PR fixes an issue when pasting text with the `editor::Paste`
command that was copied with `vim::Yank`'s linewise selection.
The change stops setting the `is_entire_line` setting when copying from
with vim linewise selections (<kbd>⇧v</kbd>) and motions (i.e.
<kbd>y2j</kbd>).
This flag is used when cutting/copying text without being selected (so,
place a cursor on line without selecting anything, and press
<kbd>⌘X</kbd>). When cutting/copying text in this manner, [the editor
pastes the text above the
cursor](36941253ee/crates/editor/src/editor.rs (L11936-L11947)).
However, this behaviour is not needed when cutting/copying with vim
motions.
Pasting with vim operations is not affected by this change. [They are
handled
elsewhere](36941253ee/crates/vim/src/normal/paste.rs)
and they don't consider the `is_entire_line` flag at all.
Note for maintainers: I'm not familiar with this codebase 🙃. This change
fixes the issue. I don't see anything breaking... but let me know if
it's not the case and a more thorough change is needed.
**Before:**
The text is copied above the first line, before the cursor.
https://github.com/user-attachments/assets/0c2f111a-5da0-4775-a7a0-2e4fb6f78bfc
**After:**
The text is copied at the cursor location:
https://github.com/user-attachments/assets/60a17985-fe8b-4149-a77b-d72bf531bf85
Release Notes:
- Fixed an issue when pasting text that was yanked with vim's linewise
selections.