Commit graph

986 commits

Author SHA1 Message Date
Danilo Leal
03102b4d7e
assistant: Allow opening the Prompt Library via the command palette (#27368)
Also took the opportunity to rename the action to something that would
be clearer in the command palette, from `DeployPromptLibrary` to
`OpenPromptLibrary`.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-03-24 21:00:33 -03:00
Peter Tripp
1cca2e37b0
keymap: Remove backspace/delete as shortcuts for git::RestoreFile (#27257)
- See also: https://github.com/zed-industries/zed/pull/27004

Release Notes:

- N/A
2025-03-21 15:48:12 +00:00
Danilo Leal
8f86cd758a
assistant2: Add design refinements (#27160)
Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-03-21 03:19:41 -03:00
Ryan Hawkins
0f5a3afe94
Support built-in Zed prompts for all platforms (#26201)
This pull request does two things:

1. Adds a setting to force Zed to use the built-in prompts, instead of
the system provided ones. I've personally found the system prompts on
macOS often fail to respond to keyboard input, are slow to render
initially, and don't match Zed's style.
2. Makes the previously Linux-only Zed provided prompts available to
everybody using the above setting.

Release Notes:
- Added support for a built-in prompting system, regardless of platform.
Use the new `use_system_prompts` setting to control whether to use the
system provided prompts or Zed's built-in system. Note that on Linux,
this setting has no effect, as Linux doesn't have a system prompting
mechanism.
2025-03-18 22:27:09 -06:00
Peter Tripp
2269f996f7
Add more shortcuts for delete/restore in Git Panel (#27004)
Release Notes:

- N/A
2025-03-18 18:52:28 -04:00
Remco Smits
41a60ffecf
Debugger implementation (#13433)
###  DISCLAIMER

> As of 6th March 2025, debugger is still in development. We plan to
merge it behind a staff-only feature flag for staff use only, followed
by non-public release and then finally a public one (akin to how Git
panel release was handled). This is done to ensure the best experience
when it gets released.

### END OF DISCLAIMER 

**The current state of the debugger implementation:**


https://github.com/user-attachments/assets/c4deff07-80dd-4dc6-ad2e-0c252a478fe9


https://github.com/user-attachments/assets/e1ed2345-b750-4bb6-9c97-50961b76904f

----

All the todo's are in the following channel, so it's easier to work on
this together:
https://zed.dev/channel/zed-debugger-11370

If you are on Linux, you can use the following command to join the
channel:
```cli
zed https://zed.dev/channel/zed-debugger-11370 
```

## Current Features

- Collab
  - Breakpoints
    - Sync when you (re)join a project
    - Sync when you add/remove a breakpoint
  - Sync active debug line
  - Stack frames
    - Click on stack frame
      - View variables that belong to the stack frame
      - Visit the source file
    - Restart stack frame (if adapter supports this)
  - Variables
  - Loaded sources
  - Modules
  - Controls
    - Continue
    - Step back
      - Stepping granularity (configurable)
    - Step into
      - Stepping granularity (configurable)
    - Step over
      - Stepping granularity (configurable)
    - Step out
      - Stepping granularity (configurable)
  - Debug console
- Breakpoints
  - Log breakpoints
  - line breakpoints
  - Persistent between zed sessions (configurable)
  - Multi buffer support
  - Toggle disable/enable all breakpoints
- Stack frames
  - Click on stack frame
    - View variables that belong to the stack frame
    - Visit the source file
    - Show collapsed stack frames
  - Restart stack frame (if adapter supports this)
- Loaded sources
  - View all used loaded sources if supported by adapter.
- Modules
  - View all used modules (if adapter supports this)
- Variables
  - Copy value
  - Copy name
  - Copy memory reference
  - Set value (if adapter supports this)
  - keyboard navigation
- Debug Console
  - See logs
  - View output that was sent from debug adapter
    - Output grouping
  - Evaluate code
    - Updates the variable list
    - Auto completion
- If not supported by adapter, we will show auto-completion for existing
variables
- Debug Terminal
- Run custom commands and change env values right inside your Zed
terminal
- Attach to process (if adapter supports this)
  - Process picker
- Controls
  - Continue
  - Step back
    - Stepping granularity (configurable)
  - Step into
    - Stepping granularity (configurable)
  - Step over
    - Stepping granularity (configurable)
  - Step out
    - Stepping granularity (configurable)
  - Disconnect
  - Restart
  - Stop
- Warning when a debug session exited without hitting any breakpoint
- Debug view to see Adapter/RPC log messages
- Testing
  - Fake debug adapter
    - Fake requests & events

---

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Piotr Osiewicz <peterosiewicz@gmail.com>
Co-authored-by: Piotr <piotr@zed.dev>
2025-03-18 12:55:25 -04:00
Peter Tripp
68bb3bd5eb
Add more shortcuts for editor::OrganizeImports (#26932)
Follow-up to:
- https://github.com/zed-industries/zed/pull/25793

Release Notes:

- N/A
2025-03-18 10:51:12 -04:00
Kirill Bulatov
566c5f91a7
Refine word completions (#26779)
Follow-up of https://github.com/zed-industries/zed/pull/26410

* Extract word completions into their own, `editor::ShowWordCompletions`
action so those could be triggered independently of completions
* Assign `ctrl-shift-space` binding to this new action
* Still keep words returned along the completions as in the original PR,
but:
* Tone down regular completions' fallback logic, skip words when the
language server responds with empty list of completions, but keep on
adding words if nothing or an error were returned instead
    * Adjust the defaults to wait for LSP completions infinitely
* Skip "words" with digits such as `0_usize` or `2.f32` from completion
items, unless a completion query has digits in it

Release Notes:

- N/A
2025-03-14 15:18:55 +00:00
Julia Ryan
2b94a35aaa
Rework git toasts (#26420)
The notifications from git output could take up variable amounts of
screen space, and they were quite obnoxious when a git command printed
lots of output, such as fetching many new branches or verbose push
hooks.

This change makes the push/pull/fetch buttons trigger a small
notification toast, based on the output of the command that was ran. For
errors or commands with more output the user may want to see, there's an
"Open Log" button which opens a new buffer with the output of that
command.

It also uses this behavior for long error notifications for other git
commands like `commit` and `checkout`. The output of those commands can
be quite long due to arbitrary githooks running.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-03-11 21:39:29 +00:00
Peter Tripp
0cf6259fec
Make nano save (ctrl-o) work by-default in terminal (linux) (#26479)
Closes: https://github.com/zed-industries/zed/issues/15770

Release Notes:

- Make nano save (`ctrl-o`) work by-default in terminal (linux)
2025-03-11 20:29:02 +00:00
Cole Miller
9bd3e156f5
Fix enter binding in git panel's commit editor on Linux (#26427)
Closes #26110 

Release Notes:

- Git Beta: fixed being unable to enter newline in the git panel's
commit editor on Linux
2025-03-11 00:26:13 -04:00
Conrad Irwin
4d1d8d6d78
Git commit modal command (#26405)
Fix KeyBinding::for_action() to use the active focus handle instead of
what was
rendered last.

This makes the UI consistently chose the cmd-escape binding for close
(because escape in the editor is editor::Cancel?),
so force it to be "escape"

Release Notes:

- git: Fixed escape tooltip in commit modal
2025-03-10 16:10:53 -06:00
Conrad Irwin
3891381d3e
Git keyboard shortcuts (#26374)
Closes #26040

Release Notes:

- git: Add keyboard shortcuts (when the panel is open) for fetch `ctrl-g
ctrl-g`, pull `ctrl-g down`, push `ctrl-g up`, force-push `ctrl-g
shift-up`, open diff `ctrl-g d`
2025-03-10 10:46:53 -06:00
Michael Sloan
450d727a04
Fixes to excerpt movement actions and bindings + add multibuffer and singleton_buffer key contexts (#26264)
Closes #26002 

Release Notes:

- Added `multibuffer` key context.
- `cmd-down` and `cmd-shift-down` on Mac now moves to the end of the
last line of a singleton buffer instead of the beginning. In
multibuffers, these now move to the start of the next excerpt.
- Fixed `vim::PreviousSectionEnd` (bound to `[ ]`) to move to the
beginning of the line, matching the behavior of `vim::NextSectionEnd`.
- Added `editor::MoveToStartOfNextExcerpt` and
`editor::MoveToEndOfPreviousExcerpt`.
2025-03-08 00:58:47 +00:00
Guilherme Gonçalves
fcc5e27455
Fix hotkey for toggle filters in project search (#25917)
Closes #24741 

Adjusted the shortcut key handling to properly toggle filters in the project search feature.

Release Notes:

- linux: Fixed `ctrl-alt-f` not correctly toggling search filters in project search.

---------

Co-authored-by: Peter Tripp <peter@zed.dev>
2025-03-07 15:27:10 +00:00
Marshall Bowers
b8a8b9c699
git_ui: Add support for generating commit messages with an LLM (#26227)
This PR finishes up the support for generating commit messages using an
LLM.

We're shelling out to `git diff` to get the diff text, as it seemed more
efficient than attempting to reconstruct the diff ourselves from our
internal Git state.


https://github.com/user-attachments/assets/9bcf30a7-7a08-4f49-a753-72a5d954bddd

Release Notes:

- Git Beta: Added support for generating commit messages using a
language model.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-03-06 19:47:52 +00:00
Conrad Irwin
c34357e2ab
Git askpass (#25953)
Supersedes #25848

Release Notes:

- git: Supporting push/pull/fetch when remote requires auth

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-03-06 05:20:06 +00:00
brian tan
22b1a02e23
vim: Implement <count>% motion (#25839)
Closes https://github.com/zed-industries/zed/discussions/25665

> Currently Zed is missing quite an useful Vim motion: <count>% (go to
{count} percentage in the file).
Description:
{count}% - Go to {count} percentage in the file, on the first non-blank
in the line linewise. To compute the new line number this formula is
used: ({count} * number-of-lines + 99) / 100 .
> [Link](https://neovim.io/doc/user/motion.html#N%25).

Release Notes:

- vim: Added `<count>%` motion

---------

Co-authored-by: Conrad Irwin <conrad@zed.dev>
2025-03-05 19:59:18 -07:00
Asqar Arslanov
3975d8ea93
vim: Rename wrapping keybindings + document cursor wrapping (#25694)
https://github.com/zed-industries/zed/pull/25663#issuecomment-2686095807

Renamed the `vim::Backspace` and `vim::Space` actions to
`vim::WrappingLeft` and `vim::WrappingRight` respectively. The old names
are still available, but they are marked as deprecated and users are
advised to use the new names.

Also added a paragraph to the docs describing how to enable wrapping
cursor navigation.
2025-03-05 08:54:30 -07:00
Conrad Irwin
85211889e5
git: Fix project diff shortcuts (#26045)
Release Notes:

- git: Fix keyboard shortcut display in project diff view
2025-03-04 10:32:20 -07:00
Bennet Bo Fenner
f4899d92a4
assistant2: Add support for editing the last message sent by the user (#26037)
https://github.com/user-attachments/assets/df46632b-dfeb-4991-ab2e-86829b72be9b

Closes #ISSUE

Release Notes:

- N/A
2025-03-04 17:57:42 +01:00
Bennet Bo Fenner
909de2ca6f
assistant2: Use cmd-n to create a new prompt editor when already in a prompt editor (#25935)
This flips the keybindings that are used to create a new thread/prompt
editor (only when you're already in a prompt editor)

Release Notes:

- N/A
2025-03-04 16:44:32 +01:00
Bennet Bo Fenner
669082dbe0
assistant2: Fix keyboard navigation issues when a picker is open (#25928)
This fixes:
- Bug: Using "up" in model selector triggers assistant2::FocusUp not
menu::SelectPrev
- Bug: Pressing arrow up/down in the model selector opened in the inline
assistant doesn't work
- Bug: Dismissing the model selector with Esc is not working
- Bug: Dismissing context pickers with Esc no longer working

Release Notes:

- N/A
2025-03-03 17:02:25 +01:00
smit
8bb2739e28
keymap: Update Prev to Previous follow-up (#25931)
Follow-up for https://github.com/zed-industries/zed/pull/25909

Add three more action replacements:

```
1. "pane::ActivatePrevItem" -> "pane::ActivatePreviousItem"
2. "vim::MoveToPrev" -> "vim::MoveToPrevious"
3. "vim:MoveToPrevMatch" -> "vim:MoveToPreviousMatch" 
```

Release Notes:

- N/A
2025-03-03 21:19:25 +05:30
smit
593f3dc1d5
keymap: Update Prev to Previous for consistency (#25909)
Closes #10167

This is take 2 on https://github.com/zed-industries/zed/pull/2341 which
was closed due to lack of migrator.

This PR contains rename of following keymap actions: 
```sh
1. ["editor::GoToPrevHunk", { "center_cursor": true }] -> ["editor::GoToPreviousHunk", { "center_cursor": true }]
2. "editor::GoToPrevDiagnostic" -> "editor::GoToPreviousDiagnostic"
3. "editor::ContextMenuPrev" -> "editor::ContextMenuPrevious"
4. "search::SelectPrevMatch" -> "search::SelectPreviousMatch"
5. "file_finder::SelectPrev" -> "file_finder::SelectPrevious"
6. "menu::SelectPrev" -> "menu::SelectPrevious"
7. "editor::TabPrev" -> "editor::Backtab"
```

Release Notes:

- Renamed several keymap actions for consistency (e.g., `GoToPrevHunk` →
`GoToPreviousHunk`, `TabPrev` → `Backtab`). Your existing configured
keybindings will still work. You can click **"Backup and Update"** at
the top of your keymap file to easily update to the new actions.


Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
2025-03-03 17:44:49 +05:30
Mikayla Maki
73ac19958a
Add user-visible output for remote operations (#25849)
This PR adds toasts for reporting success and errors from remote git
operations. This PR also adds a focus handle to notifications, in
anticipation of making them keyboard accessible.

Release Notes:

- N/A

---------

Co-authored-by: julia <julia@zed.dev>
2025-03-03 09:20:15 +00:00
Ben Kunkle
fec228bb23
Fix issue with cmd-w closing window in preview tabs on MacOS (#25878)
Closes #25810

Reorders default macOS keymap so that `cmd-w` in `"context":
"PromptLibrary"` bindings is not the last binding for
`workspace::CloseWindow` and therefore does not get rendered in the app
menu or intercepted by MacOS

Release Notes:

- N/A
2025-03-01 19:33:01 -06:00
João Marcos
2d61a51ded
Diff View: Scroll to center of hunks when reviewing (#25846)
When reviewing hunks, scroll to put them at the center of the screen
so you can better see the context around that hunk.

The field `center_cursor` was added to the actions `editor::GoToHunk`
and `editor::GoToPrevHunk`, this was set to `false` by default in
keymaps, as it wouldn't help with in-editor navigation.

The field is set to `true` for when you trigger `git::StageAndNext`
and `git::UnstageAndNext`, this is also `true` for the buttons in the
Diff View toolbar.

Release Notes:

- N/A
2025-03-01 03:20:26 +00:00
João Marcos
a2876f5d3e
Support hunk-wise StageAndNext and UnstageAndNext (#25845)
This PR adds the `whole_excerpt` field to the actions:

- `git::StageAndNext`
- `git::UnstageAndNext`

Which is set by false by default, effectively, now staging and unstaging
with these actions is done hunk-by-hunk, this also affects the `Stage`
and
`Unstage` buttons in the Diff View toolbar.

A caveat: with this PR, there is no way to configure the buttons in the
Diff
View toolbar to restore the previous behavior, if we want, I think we
can make
it a setting, but let's see if anyone really wants that.

Release Notes:

- N/A
2025-03-01 02:39:08 +00:00
smit
fad4df5e70
editor: Add Organize Imports Action (#25793)
Closes #10004

This PR adds support for the organize imports action. Previously, you
had to manually configure it in the settings and then use format to run
it.

Note: Default key binding will be `alt-shift-o` which is similar to
VSCode's organize import. Also, because `cmd-shift-o` is taken by
outline picker.

Todo:

- [x] Initial working
- [x] Handle remote
- [x] Handle multi buffer
- [x] Can we make it generic for executing any code action?

Release Notes:

- Added `editor:OrganizeImports` action to organize imports (sort,
remove unused, etc) for supported LSPs. You can trigger it by using the
`alt-shift-o` key binding.
2025-03-01 00:59:09 +05:30
Mikayla Maki
8ba7b349a5
Make the branch picker in the commit modal a popover (#25697)
Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2025-02-27 01:56:07 +00:00
Conrad Irwin
7f214ed25a
git: Fix cmd-enter (#25628)
Closes #ISSUE

Release Notes:

- N/A
2025-02-25 23:07:55 -07:00
Peter Tripp
278620df33
Ensure emacs undo (ctrl-_) works by default in terminal on macOS (#25578) 2025-02-25 13:01:46 -05:00
Peter Tripp
eebee4ab18
Add stop_at_indent for MoveToBeginningOfLine (#25428)
Add support for `stop_at_indent` option for MoveToBeginningOfLine and SelectToBeginningOfLine instead of mixing that with `stop_at_soft_wraps`.
Add emacs mapping for `alt-m` (`back-to-indentation`)
2025-02-25 12:03:14 -05:00
Peter Tripp
2d63f7628f
Remove cmd-g for git::Commit (#25524)
Conflicts with `search::SelectNextMatch`
2025-02-25 01:45:45 +00:00
João Marcos
f1e6b144e8
Git: Add hotkey to open file from changes list (#25500)
Release Notes:

- N/A
2025-02-24 21:22:25 +00:00
Nate Butler
30af8d0a81
git_ui: Commit modal refinement (#25484)
Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-02-24 19:19:06 +00:00
Peter Tripp
d8694510b5
emacs: Add support for paragraph navigation (#25284)
- emacs: Added support for `alt-{` and `alt-}` paragraph navigation
2025-02-24 19:02:07 +00:00
João Marcos
ec7ce41324
Git: Fix Linux bindings (#25486)
- Tooltip with binding wasn't showing up
- Missing Linux bindings
- Commit modal wasn't opening when binding was pressed

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-02-24 18:49:17 +00:00
Peter Tripp
64756fa96f
Fix tmux being broken by default on Linux (#25476)
Tmux uses `ctrl-b` as default prefix.
Prior to this tmux was basically useless in the default zed configuration.
(ctrl-b would toggle the left dock).
2025-02-24 13:43:15 -05:00
Danilo Leal
f020291039
assistant: Rename action from New Context to New Chat (#25455)
If you looked that up via the Command Palette, we were showing an
outdated action name ("new context") which causes confusion given the
panel says "New Chat".

Release Notes:

- N/A
2025-02-24 09:19:38 -03:00
Thomas Heartman
084a0233b6
vim: Add exchange (#24678)
Implements [vim-exchange](https://github.com/tommcdo/vim-exchange)
functionality.

Lets you swap the content of one selection/object/motion with another.

The default key bindings are the same as in exchange:
- `cx` to begin the exchange in normal mode. Visual mode does not have a
default binding due to conflicts.
- `cxx` selects the current line
- `cxc` clears the selection
- If the previous operation was an exchange, `.` will repeat that
operation.

Closes #22759

## Overlapping regions

According to the vim exchange readme:

> If one region is fully contained within the other, it will replace the
containing region.

Zed does the following:
- If one range is completely contained within another: the smaller
region replaces the larger region (as in exchange.vim)
- If the ranges only partially overlap, then we abort and cancel the
exchange. I don't think we can do anything sensible with that. Not sure
what the original does, evil-exchange aborts.

## Not implemented: cross-window exchange

Emacs's evil-exchange allows you to exchange across buffers. There is no
code to accommodate that in this PR. Personally, it'd never occurred to
me before working on this and I've never needed it. As such, I'll leave
that implementation for whomever needs it.

As an upside; this allows you to have concurrent exchange states per
buffer, which may come in handy.

## Bonus

Also adds "replace with register" for the full line with `grr` 🐕 This
was an oversight from a previous PR.

Release notes:

- Added an implementation of `vim-exchange`
- Fixed: Added missing default key binding for `Vim::CurrentLine` for
replace with register mode (`grr`)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-02-22 20:36:21 +00:00
mattmc3
5043eaedc4
Change C-a C-e keybindings to match macOS default behavior (#25385)
Closes #25372
2025-02-22 13:43:38 +00:00
Kirill Bulatov
83513bab59
Emphasize defaults for line movement actions (#25378)
Closes https://github.com/zed-industries/zed/issues/25372

Release Notes:

- N/A
2025-02-22 08:08:16 +00:00
Cole Miller
4118f42d61
Rename ExpandAllHunkDiffs to ExpandAllDiffHunks (#25369)
This is more consistent with the nomenclature in the rest of Zed.

Release Notes:

- Renamed the `editor::ExpandAllHunkDiffs` action to
`editor::ExpandAllDiffHunks`
2025-02-21 19:06:03 -05:00
Conrad Irwin
4871d3c9e7
New commit review flow in project diff view (#25229)
Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2025-02-21 06:52:34 +00:00
0x2CA
6b9397c380
vim: Fix gr in visual mode (#25301)
Closes #25258

Release Notes:

- Fixed `gr` in visual mode
2025-02-20 23:39:11 -07:00
Michael Sloan
30850fe3bd
Add editor actions for moving and selecting to next / previous excerpt (#25299)
Covers part of #5129 by adding `MoveToStartOfExcerpt`,
`MoveToEndOfExcerpt`, `SelectToStartOfExcerpt`, and
`SelectToEndOfExcerpt`.

No default linux bindings yet as it's unclear what to use. Currently,
`ctrl-up` / `ctrl-down` scroll up and down by one line (see #13269).
Considering changing the meaning of those.

Mac:

* Previously `cmd-up` and `cmd-down` were `editor::MoveToBeginning` and
`editor::MoveToEnd`. In singleton editors these will behave the same as
before. In multibuffers, they will now step through excerpts instead of
jumping to the beginning / end of the multibuffer.

* `cmd-home` and `cmd-end`, often typed as `cmd-fn-left` and
`cmd-fn-right` are now `editor::MoveToBeginning` and
`editor::MoveToEnd`. This is useful in multibuffers.

Release Notes:

- Mac: `cmd-up` now moves to the previous
multibuffer excerpt start, and `cmd-down` moves to the next multibuffer
excerpt end. Within normal buffers these behave the same as before, moving
to the beginning or end.
2025-02-21 00:23:20 +00:00
Peter Tripp
4151b5b12b
Make cmd-t open new tab in Assistant (#25267)
Match the behavior of chrome, safari, etc.

Release Notes:

- N/A
2025-02-20 15:56:28 -05:00
0x2CA
78a8002415
keymap: Fix shift- modifier symbol (#25238)
Closes #25230

```
The shift- modifier can only be used in combination with a letter to indicate the uppercase version. For example shift-g matches typing G. Although on many keyboards shift is used to type punctuation characters like (, the keypress is not considered to be modified and so shift-( does not match.
```

[Document](https://zed.dev/docs/key-bindings#keybinding-syntax)

Release Notes:

- Fixed Keymap use `shift-` modifier symbol
2025-02-20 08:47:51 -07:00