Commit Graph
88 Commits
Author SHA1 Message Date
joaquin30andConrad Irwin 499095a475 vim: Fix cgn backwards movement when there is no matches (#10237)
Release Notes:

- Fixed `cgn` backwards movement problem in #9982

There are two issues:

- When there are no more matches, the next repetition still moves the
cursor to the left. After that, the recording is cleared. For this I
simply move the cursor to the right, but it doesn't work when the cursor
is at the end of the line.
- If `cgn` is used when there are no matches, it cleans the previous
recorded actions. Maybe there should be a way to revert the recording.
This also happens when using `c` and `esc`

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-08 14:51:36 -06:00
joaquin30andConrad Irwin d42848bf47 vim: Support gn command and remap gn to gl (#9982)
Release Notes:

- Resolves #4273

@algora-pbc /claim #4273

This is a work-in-progress. The process for `gn` command is:

- maintain updated vim.workspace_state.search.initial_query
- modify editor.select_next_state with
vim.workspace_state.search.initial_query
- use editor.select_next()
- merge selections
- set editor.select_next_state to previous state

To make this possible, several private members and editor structures are
made public. `gN` is not yet implemented and the cursor still does not
jump to the next selection in the first use.

Maybe there is an better way to do this?

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-05 20:23:37 -06:00
Hans 840c11bf2e vim: Fix t operand not working correctly when cursor is on tag (#9899)
Fix #8994 and #9844 

Release notes:
* Fixed the `t` object in Vim mode not working correctly when cursor was
on a tag. #9844 and #8994

This mr fixes the above two problems, for #9844, because our previous
logic is to only think that the minimum html tag containing the current
cursor is qualified, but the approach of nvim is to get the tag after
the current cursor first, followed by the tag around the current cursor,
so I modified the corresponding condition

For #8994, the situation is a bit more complicated, in our previous
implementation, we could only get the range of the object by a `cursor
position`, but there are two possible cases for the html tag:
When the current cursor length is 1, nvim will return the first tag
after the current cursor, as described above
When the current cursor length is greater than 1, nvim will return just
the smallest tag that can cover the current selection

So we may need to pass the current selection to the inside of the
method, and the point alone is not enough to support us in calculating
these conditions
2024-03-28 10:16:54 +01:00
Noritada Kobayashi 31dfca23df vim: Add support for ap and ip paragraph text objects (#7687)
This PR adds support for `ap`/`ip` text objects in Vim mode and allows
users to perform paragraph-based operations.

Cases where compatibility with Neovim's behavior is checked, cases where
there are known differences in behavior with Neovim (cases where the
landing position is other than the beginning of the line), and cases
where the Neovim behavior in the test suite seems strange are separated
in the test code so that they can be identified.

Release Notes:

- Added support for `ap` and `ip` paragraph text objects in Vim mode
([#7359](https://github.com/zed-industries/zed/issues/7359)).
2024-03-04 16:39:02 -07:00
Marshall Bowers 8e9a4ce6eb Enable clippy::nonminimal_bool (#8755)
This PR enables the
[`clippy::nonminimal_bool`](https://rust-lang.github.io/rust-clippy/master/index.html#/nonminimal_bool)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 22:57:37 -05:00
Marshall Bowers 86e31db1fb Enable clippy::clone_on_copy (#8728)
This PR enables the
[`clippy::clone_on_copy`](https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_copy)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:37:48 -05:00
Conrad Irwin f7048c5e22 vim: Fix some problems with visual mode testing (#8461)
Release Notes:

- N/A
2024-02-26 20:15:27 -07:00
Mahdy M. KaramandConrad Irwin ac4870b45c Add option to either use system clipboard or vim clipboard (#7936)
Release Notes:

- vim: Added a setting to control default clipboard behaviour. `{"vim":
{"use_system_clipboard": "never"}}` disables writing to the clipboard.
`"on_yank"` writes to the system clipboard only on yank, and `"always"`
preserves the current behavior. ([#4390
](https://github.com/zed-industries/zed/issues/4390))

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-02-22 10:12:29 -07:00
Joseph T. Lyons 1624a5d6b8 Update all links point to community 2024-01-24 15:11:17 -05:00
Mikayla Maki 607f2a7ba5 Add typo detection to CI (#4107)
Adding the typos crate to our CI will take some doing, as we have
several tests which rely on typos in various ways (e.g. checking state
as the user types), but I thought I'd take a first stab at fixing what
it finds.

Release Notes:

- N/A
2024-01-17 17:13:47 -08:00
Piotr OsiewiczandKirill f4f65e9c2c Editor docs (#4097)
Release Notes:

- N/A

---------

Co-authored-by: Kirill <kirill@zed.dev>
2024-01-18 00:48:37 +01:00
Mikayla 85a27d46c7 fmt 2024-01-17 14:44:10 -08:00
Mikayla 0b43bd7c14 Fix typos detected by crate-ci/typos 2024-01-17 14:31:21 -08:00
Max BrunsfeldandMikayla 450537ac2a Remove 2 suffix for vim, diagnostics, go_to_line, theme_selector, command_palette, file_finder
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 10:42:49 -08:00
Conrad Irwin 92e91e5b45 Fix some bugs with vim objects
- softwrap interaction
- correct selection if cursor is on opening marker
2023-10-22 21:44:34 -06:00
Conrad Irwin 8415926840 Hide any circumstantial evidence that this didn't work perfectly first
time
2023-10-20 14:45:37 -06:00
Conrad Irwin 7186969334 Fix bug in vim visual block mode 2023-10-20 11:49:10 -06:00
Conrad Irwin 83d315d720 Fix single column vim selections 2023-10-20 11:17:19 -06:00
Conrad Irwin 3d5cbcaad1 Refactor TextLayoutDetails construction 2023-10-18 22:56:11 -06:00
Conrad Irwin 7436ed4d45 Make vim visual block work better 2023-10-18 22:23:06 -06:00
Conrad Irwin ccc2c5fdd6 Use Horizontal ranges everywhere 2023-10-09 21:48:50 -06:00
Conrad Irwin a1ae399638 Get the project running! 2023-10-09 21:48:31 -06:00
Conrad Irwin 3b6bb008b6 vim: Add multicursor shortcuts
- g n / g N to select next/previous
- g > / g < to select next/previous replacing current
- g a to select all matches
2023-09-25 15:32:03 -06:00
Conrad Irwin a22d09c9d7 Fix Y on last line with no trailing new line
For zed-industries/community#2044
2023-09-15 11:14:04 -06:00
Conrad Irwin 17c2ee6ed1 Add visual area repeating 2023-09-07 10:45:38 -06:00
Conrad Irwinand 204e716a5d vim . to replay
Co-Authored-By: maxbrunsfeld@gmail.com
2023-09-06 13:49:55 -06:00
Conrad Irwin 389a5ebabc vim: Fix relative line motion
Before this change up and down were in display co-ordinates, after this
change they are in fold coordinates (which matches the vim behaviour).

To make this work without causing usabliity problems, a bunch of extra
keyboard shortcuts now work:

- vim: `z {o,c}` to open,close a fold
- vim: `z f` to fold current visual selection
- vim: `g {j,k,up,down}` to move up/down a display line
- vim: `g {0,^,$,home,end}` to get to start/end of a display line

Fixes: zed-industries/community#1562
2023-08-25 14:40:04 -06:00
Conrad Irwin c591a6b231 Fix zed-industries/community#1950 2023-08-25 11:34:07 -06:00
Max Brunsfeld 0596c2f103 Format let-else statements 2023-08-25 10:11:32 -07:00
Mikayla Maki c4e7adf6f0 Introduce channel notes (#2880)
![Screen Shot 2023-08-24 at 5 26 53
PM](https://github.com/zed-industries/zed/assets/326587/3e84c5a6-1aaf-4335-a880-4c32eb83332d)

### Todo

* [x] Snapshot channel buffers when everyone closes the buffer
* [x] Ensure that users who are in both a project and a channel note
have the same color in both places
* [x] Allow following project collaborators into channel notes
* [x] Expose notes for the current channel under "Current Call" section
of the collaboration panel
* [x] Offline state for the channel notes view
* [x] Make the channel context menu accessible to all members (to expose
the notes)
* [x] Wire in view and Item method overrides

Release Notes:

- N/A
2023-08-24 18:01:28 -07:00
Max BrunsfeldandMikayla 90b815e2f9 Make channel notes view searchable and navigable via pane history
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-24 17:18:18 -07:00
Conrad Irwin 4a80e136c9 vim: Fix linewise copy of last line with no trailing newline
Along the way, delete the VimBindingTestContext by updating the
visual tests to no-longer need it.
2023-08-24 00:00:12 -06:00
Conrad Irwin 21b6d69d61 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 9f6567f2a9 Fix visual objects
Adds 'a'/'i' in visual mode
2023-08-17 17:13:23 -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
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
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
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 9fa277f4b3 TEMP 2023-08-02 15:06:46 +01: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 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
Julia ba89ca0ddb Avoid panic from assuming a vim operator exists on the operator stack 2023-07-21 14:25:30 -04:00
Conrad Irwin 81edc7afc5 vim: Fix 1G
Before this change code could not distinguish between a user providing a
count of 1 and no count at all.

Fixes: zed-industries/community#710
2023-06-22 12:11:14 -06:00
Antonio Scandurra 8b5cdda569 Initialize the active editor when vim mode is enabled
Instead of waiting for a focus event. This makes more tests pass.
2023-04-20 14:02:40 -06:00