Commit Graph
1181 Commits
Author SHA1 Message Date
Conrad Irwin 39b149d1f9 Preserve line mode selection on undo
This diverges from vim's behaviour (which collapses the
cursor to a single point on undo).
2023-08-17 15:40:27 -06:00
Conrad Irwin 82b40f4136 Fix edge-cases in visual block insert 2023-08-17 15:16:26 -06:00
Conrad Irwin 03c12decbc Store some vim state per-editor
This fixes a bug where opening and closing command would reset your
selection incorrectly.
2023-08-17 14:09:47 -06:00
Mikayla a37da1b636 Merge branch 'main' into project_search_design 2023-08-17 01:56:05 -07:00
Conrad Irwin 03e0c6d2d6 Tidy-up 2023-08-16 22:29:28 -06:00
Conrad Irwin 17f8742a27 Disable autoindent in visual block insert mode 2023-08-16 10:44:59 -06:00
KCaverly 4e3526b616 Merge branch 'main' of github.com:zed-industries/zed into project_search_design 2023-08-16 12:43:04 +01:00
Conrad Irwin d37246dee7 Vim visual block mode
This isn't quite an exact emulation, as instead of using one selection
that is magically in "column mode", we emulate it with a bunch of zed
multi-selections (one per line).

I think this is better, as it requires fewer changes to the codebase,
and lets you see the impact of any changes immediately on all lines.

Fixes: zed-industries/community#984
2023-08-15 16:00:50 -06:00
Max BrunsfeldandMikayla 96f14e23a9 Run until parked when setting editor's state via EditorTestContext
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-15 13:42:54 -07:00
Conrad Irwin 99321c01b7 Add a VisualBlock mode
Instead of trying to extend the Mode::Visual special case, just split
out into three different modes.
2023-08-15 10:00:45 -06:00
Conrad Irwin 3aec608f60 Fix vim selection to include entire range (#2787)
Update vim mode to have vim selection and editor selections match.
Before this we had to adjust between vim selections and real selections
when making changes; now we have to adjust when making selections.

Release Notes:

- vim: Ensure editor selection matches the vim selection
([#1796](https://github.com/zed-industries/community/issues/1796)).
- vim: Fix `s` in visual line mode
- vim: Add `o` and `shift-o` to toggle direction of visual selection
- vim: Fix `v` and `shift-v` to toggle back to normal mode
- vim: Fix block selections like `vi}` to contain correct whitespace
2023-08-15 08:36:17 -06:00
Conrad Irwin 8e909670cd Fix vim escape in normal mode
Fixes: zed-industries/community#1857
2023-08-14 16:05:41 -06:00
Conrad Irwin ff42104392 Merge branch 'main' into vim-visual-selection 2023-08-14 15:29:33 -06:00
Piotr Osiewicz a5f96dade0 Merge branch 'main' into project_search_design 2023-08-09 12:30:48 +02:00
Nathan Sobo c843749cb0 Store an AnyWindowHandle in WindowContext 2023-08-08 11:08:37 -06:00
Piotr Osiewicz 7f2d4abe4b Finish migration to modes for buffer search 2023-08-08 15:57:07 +02:00
Piotr Osiewicz 87f8fa36a7 Remove SearchOptions::REGEX.
A bit WIP as it awaits migration of buffer search to modes
2023-08-08 14:42:11 +02:00
Nathan Sobo ce33bd19e5 Get compiling 2023-08-07 19:08:58 -06:00
Max Brunsfeld a318f5465e Fix warnings surfaced in Rust 1.71 2023-08-02 09:19:23 -07:00
Conrad Irwin 9fa277f4b3 TEMP 2023-08-02 15:06:46 +01:00
Kirill Bulatov a4f69b5b45 Add buffer search history 2023-08-01 01:31:28 +03:00
Conrad Irwin 2921cd77ca Fix visual selection of trailing newline 2023-07-28 22:38:39 -06:00
Conrad Irwin e6f1a6f9a9 Merge VisualChange -> Substitute
They both are supposed to work the same.
2023-07-28 15:32:02 -06:00
Conrad Irwin 4222ffad80 Fix substitute in visual line mode 2023-07-28 15:26:40 -06:00
Conrad Irwin 29b0f54255 Add o/O for flipping selection 2023-07-28 15:26:40 -06:00
Conrad Irwin 35e3b03af6 Fix crash when deleting a long line in visual line mode 2023-07-28 15:26:40 -06:00
Conrad Irwin adc89d3418 Add support for visual ranges ending with a newline
These primarily happen when first entering visual mode, but can also
be created with objects like `vi{`.

Along the way fix the way ranges like `vi{` are selected to be more
similar to nvim.
2023-07-28 15:26:40 -06:00
Conrad IrwinandMax Brunsfeld 737efc0c9d Fix vim selection to include entire range
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2023-07-28 15:26:40 -06:00
Mikayla Maki fb2c85ee9e Make mode indicator follow vim enabled state 2023-07-27 16:14:56 -07:00
JuliaandMikayla Maki 9f5ffa2b6e Avoid panic by accessing view handle by global in wrong window
View handles are window specific but this global will be doing things
in all windows, that would cause a panic when it attempted to update
a status bar mode indicator in a background window

Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-07-27 18:53:05 -04:00
Conrad Irwin 44f4f14010 Add a mode indicator for vim (#2763)
Release Notes:

- vim: add a mode indicator
([#409](https://github.com/zed-industries/community/issues/409))

Now updated screenshots with @iamnbutler 
<img width="1043" alt="Screenshot 2023-07-25 at 11 11 57"
src="https://github.com/zed-industries/zed/assets/94272/8301479a-8b58-42d8-81a1-bc40e1e0a4df">
<img width="1043" alt="Screenshot 2023-07-25 at 11 12 00"
src="https://github.com/zed-industries/zed/assets/94272/89c3b8bd-9cbc-4fd7-ad10-dac5538ed3a3">
<img width="1043" alt="Screenshot 2023-07-25 at 11 12 12"
src="https://github.com/zed-industries/zed/assets/94272/adc87fe3-a720-4779-853b-df9443407046">
2023-07-25 20:18:23 -06:00
Conrad IrwinandMikayla Maki e81bab4e2e A little refactor
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-07-25 12:55:01 -06:00
Conrad IrwinandNate Butler 8fd9cba675 Update status bar theming
Co-Authored-By: Nate Butler <iamnbutler@gmail.com>
2023-07-25 11:06:41 -06:00
Conrad Irwin 1fccc35107 Refactor mode indicator to remove itself
One of the problems we had is that the status_bar shows a gap between
items, and we want to not add an additional gap for an invisible status
indicator.
2023-07-24 09:51:54 -06:00
Conrad Irwin 6ef1e48a77 Add a mode indicator for vim
This is the second most common remaining complaint (after :w not
working).

Fixes: zed-industries/community#409
2023-07-21 16:06:14 -06:00
Julia 6241c9f305 Avoid panic from assuming a vim operator exists on the operator stack (#2773)
Fixes
https://linear.app/zed-industries/issue/Z-338/operator-popped-when-no-operator-was-on-the-stack-this-likely-means

Release Notes:
- Fixed a panic that could occur when invoking a Vim object without an
operator.
2023-07-21 14:47:38 -04:00
Julia ba89ca0ddb Avoid panic from assuming a vim operator exists on the operator stack 2023-07-21 14:25:30 -04:00
Conrad Irwin f73e9f73b5 Vim shortcuts (#2760)
Refactors some of the vim bindings to make the vim.json file less
obtuse.

Release Notes:

- vim: add `;` and `,` to repeat last `{f,F,t,T}`
- vim: add zed-specific shortcuts for common IDE actions:
- - `g A` to find all references
- - `g .` to open the code actions menu.
- - `c d` for rename
2023-07-21 10:31:18 -06:00
Conrad Irwin 5ddb6c1db0 vim: add , and ; 2023-07-21 09:50:22 -06:00
Conrad Irwin 0f8a1759ae Quality of life shortcuts for code actions 2023-07-21 09:47:15 -06:00
Conrad Irwin a29e2eb5d4 refactor: Remove G/Z Namespace support
This previously enabled things like `d g g` to work, but we can
fix that instead by not clearing out pending vim state on change.

Either way, it is unnecessary and causes some user-confusion
(zed-industries/community#176), so remove this code for now; and use
comments to organize the file a bit instead.
2023-07-21 09:47:14 -06:00
Conrad Irwin 06405e4e19 Fix shift-enter in search
If you want to type a newline in an auto_height editor, ctrl and
ctrl-shift are your friends.
2023-07-21 09:10:12 -06:00
Conrad Irwin 94bdefefbe Fix enter in search 2023-07-20 20:48:36 -06:00
Conrad Irwin 63c6387539 Avoid optional on select_match 2023-07-17 12:49:59 -06:00
Conrad Irwin 385cc12725 Rebuild vim search experience on refactored code 2023-07-07 15:57:54 -06:00
Conrad IrwinandAntonio 04e5a0f3a5 Make search less magic
Co-Authored-By: Antonio <antonio@zed.dev>
2023-07-07 15:57:54 -06:00
Conrad Irwin 2cdf99a37b Better waiting in tests 2023-07-07 15:57:54 -06:00
Conrad Irwin 1b1c0d472f vim: ? to search backwards, and /<enter> to repeat search 2023-07-07 15:57:52 -06:00
Conrad Irwin b4a01fb7dd vim: add */#/g*/g# for jumping to next word
As in vim, this toggles the normal search experience.
2023-07-07 15:57:35 -06:00
Conrad Irwin 23ccb140d5 vim: Enter/n/N to navigate search results 2023-07-07 15:57:14 -06:00