Commit Graph
241 Commits
Author SHA1 Message Date
Conrad Irwin 33d7fe02ee Rewrite paste
- vim: support P for paste before
- vim: support P in visual mode for paste without overriding clipboard
- vim: fix position when using `p` on text copied outside zed
- vim: fix indentation when using `p` on text copied from zed
2023-08-22 13:27:57 -06:00
Conrad Irwin 168a213a44 Add test for word characters in vim 2023-08-21 22:37:14 -06:00
Piotr Osiewicz 6137d88a54 Merge branch 'main' into Z-2819 2023-08-21 17:41:27 +02:00
Piotr Osiewicz ab5bd0ac5a Use new char_kind (parameterized by language) 2023-08-21 17:39:38 +02:00
Conrad Irwin 3ab3042e95 Don't show vim mode when disabled 2023-08-18 15:50:34 -06:00
Conrad Irwin 93461d366c Fix <Enter> to go to non-whitespace character
Fixes: zed-industries/community#831
2023-08-18 12:24:39 -06:00
Conrad Irwin e3c0e93e46 Fix cursor adjustment on scroll
Fixes: zed-industries/community#1929

Also preserves visual modes correctly.
2023-08-18 11:23:43 -06:00
Conrad Irwin d1aa82bb48 vim visual block (#2849)
Release notes:

- vim: add Visual Block mode
([#984](https://github.com/zed-industries/community/issues/984)),
([#1415](https://github.com/zed-industries/community/issues/1415)).
- vim: add support for `a<object>` and `i<object>` in visual modes
- vim: fix scroll shortcuts (`ctrl-{f,b,d,u,e,y}`) in visual modes
- allow `shift-enter` to type a newline.
2023-08-18 09:55:40 -06:00
Conrad Irwin b0ba0f8851 Fix visual objects
Adds 'a'/'i' in visual mode
2023-08-17 17:13:23 -06:00
Conrad Irwin d4276acab8 Give up on monospace indicator
Changing mode almost always introduces the (1 selected) text in
the status bar, so we may as well also keep the --'s for block and line
mode.
2023-08-17 16:04:55 -06:00
Conrad Irwin eb0b2e60bb 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 59d1a5632f Fix edge-cases in visual block insert 2023-08-17 15:16:26 -06:00
Conrad Irwin 3514816ece 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 afebe3faf8 Merge branch 'main' into project_search_design 2023-08-17 01:56:05 -07:00
Conrad Irwin 7598030102 Tidy-up 2023-08-16 22:29:28 -06:00
Conrad Irwin 7f06191c9f Disable autoindent in visual block insert mode 2023-08-16 10:44:59 -06:00
KCaverly d727ba18f2 Merge branch 'main' of github.com:zed-industries/zed into project_search_design 2023-08-16 12:43:04 +01:00
Conrad Irwin 1b4dd49b1d 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 943aeb8c09 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 1cc0798aea 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 404b1aa65a 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 1af7425059 Fix vim escape in normal mode
Fixes: zed-industries/community#1857
2023-08-14 16:05:41 -06:00
Conrad Irwin fb90eada70 Merge branch 'main' into vim-visual-selection 2023-08-14 15:29:33 -06:00
Piotr Osiewicz 7ef5656f6a Merge branch 'main' into project_search_design 2023-08-09 12:30:48 +02:00
Nathan Sobo d896d89842 Store an AnyWindowHandle in WindowContext 2023-08-08 11:08:37 -06:00
Piotr Osiewicz 343e9d080e Finish migration to modes for buffer search 2023-08-08 15:57:07 +02:00
Piotr Osiewicz c53554ead3 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 486f5bc6ca Get compiling 2023-08-07 19:08:58 -06:00
Max Brunsfeld a127b0d3e6 Fix warnings surfaced in Rust 1.71 2023-08-02 09:19:23 -07:00
Conrad Irwin 5f6535e92b TEMP 2023-08-02 15:06:46 +01:00
Kirill Bulatov 646dabe113 Add buffer search history 2023-08-01 01:31:28 +03:00
Conrad Irwin 645c149344 Fix visual selection of trailing newline 2023-07-28 22:38:39 -06:00
Conrad Irwin 0c15ef7305 Merge VisualChange -> Substitute
They both are supposed to work the same.
2023-07-28 15:32:02 -06:00
Conrad Irwin 236b755b1d Fix substitute in visual line mode 2023-07-28 15:26:40 -06:00
Conrad Irwin e3788cc6e6 Add o/O for flipping selection 2023-07-28 15:26:40 -06:00
Conrad Irwin 3f2f3bb78d Fix crash when deleting a long line in visual line mode 2023-07-28 15:26:40 -06:00
Conrad Irwin 5edcb74760 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 b53fb8633e 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 03bc430bdd Make mode indicator follow vim enabled state 2023-07-27 16:14:56 -07:00
JuliaandMikayla Maki fc9687d163 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 39f02c2b72 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 64b252e81a A little refactor
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-07-25 12:55:01 -06:00
Conrad IrwinandNate Butler 1f65effe57 Update status bar theming
Co-Authored-By: Nate Butler <iamnbutler@gmail.com>
2023-07-25 11:06:41 -06:00
Conrad Irwin 43d94e37ec 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 458916409c 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 e002d9efb0 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 243a1a854e Avoid panic from assuming a vim operator exists on the operator stack 2023-07-21 14:25:30 -04:00
Conrad Irwin 56c657fe79 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 4772e4ccee vim: add , and ; 2023-07-21 09:50:22 -06:00
Conrad Irwin a50d30bf8e Quality of life shortcuts for code actions 2023-07-21 09:47:15 -06:00