Commit Graph
204 Commits
Author SHA1 Message Date
Kirill Bulatov a4f69b5b45 Add buffer search history 2023-08-01 01:31:28 +03: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
Conrad Irwin 6e6b7b87ca vim: Don't enter visual mode in search/go to definition
Fixes: zed-industries/community#1514
Contributes: zed-industries/community#1284
2023-07-07 15:56:37 -06:00
Conrad Irwin 5978a6b221 vim: indent in visual mode uses only one <
Fixes: zed-industries/community#1562
2023-07-07 15:56:35 -06:00
Conrad Irwin eff7089db8 vim: { } to navigate by paragraph (#2668)
As part of this I added `assert_shared_state()` to the
NeovimBackedTestContext so that it is more like a drop-in replacement
for the VimTestContext.

The remaining part of zed-industries/community#682 is adding bracket
matching to plain text. It looks like the current logic requires there
to be a tree sitter language for the language in order to support
bracket matching. I didn't fix this in this PR because I was unsure
whether to try and work around that, or to try and add a plain text tree
sitter language.

Release Notes:

- vim: support `{` and `}` for paragraph motion
([#470](https://github.com/zed-industries/community/issues/470)).
- vim: fix `%` at the end of the line
([#682](https://github.com/zed-industries/community/issues/682)).
2023-07-07 14:59:06 -06:00
Conrad Irwin d9d5f16fb0 vim: keymap tweaks (#2674)
A few small tweaks to fix some of the community issues

Release Notes:

- vim: Fix `escape` in command palette
([#1347](https://github.com/zed-industries/community/issues/1347)).
- vim: Allow `^` as a motion in actions
([#856](https://github.com/zed-industries/community/issues/856)).
- vim: Allow `ctrl-c` to exit visual mode
([#1447](https://github.com/zed-industries/community/issues/1447)).
2023-07-07 14:58:01 -06:00
Piotr Osiewicz fc1830dd9b chore: Replace lazy_static Mutex with const. (#2693)
Mutex::new() is const-stable as of Rust 1.63.

Release Notes:
- N/A
2023-07-07 15:07:12 +02:00
Conrad Irwin 373c6bd9be vim: Further improve ~ handling
Now works with Visual{line} mode, collapses selections like nvim,
and doesn't fall off the end of the line.
2023-07-03 23:58:09 -06:00
Conrad Irwin 97d1701e1c Remove editor::Cancel binding from vim
When you hit <escape> in the command palette, it first editor::Cancel
because the command palette is also a focused editor; this binding was
catching before the `menu::Cancel` that you probably want.

From looking at the uses of editor::Cancel it seems like the only way to
trigger this is with <escape> in an editor. Rather than trying to hook
into the existing editor cancel and add vim-specific behaviour, we'll
instead take responsibility for binding directly to <escape> when
necessary.

Fixes: zed-industries/community#1347
2023-07-03 15:26:39 -06:00
Conrad Irwin f11eaf983c Fix % when on the last character of the line
Contributes: zed-industries/community#682
2023-07-01 13:51:11 -06:00
Conrad Irwin e5b58d8682 vim: Fix edge-case in } when trailing newline is absent
Added .assert_shared_state() to NeovimBackedTestContext – although it's
not strictly necessary to show the expected behaviour in the test file
(as we can just compare to neovim's JSON recording), it makes it much
easier to understand what we're testing.
2023-06-29 23:31:22 -06:00
Conrad Irwin dd53b256cb vim: Add }/{ for start/end of paragraph
Fixes: zed-industries/community#470
2023-06-29 23:31:22 -06:00
Nathan Sobo cb9ffd81cf vim: indent/outdent (#2644)
Release Notes:

- vim: support indent/outdent
([#832](https://github.com/zed-industries/community/issues/832>)).
2023-06-27 04:15:55 -06:00
Nathan Sobo 1a5f35c7a2 Vim toggle case (#2648)
Release Notes:

- vim: Add ~ to toggle case
([#1410](https://github.com/zed-industries/community/issues/1410))
2023-06-27 04:13:24 -06:00
Nathan Sobo 8f7fa752cd Merge remote-tracking branch 'origin/main' into vim-indent 2023-06-27 12:09:47 +02:00
Conrad Irwin 72df76d5f0 vim: Add ~ to change case
Fixes: zed-industries/community#1410
2023-06-26 20:22:24 -06:00
Conrad Irwin 3218a471fc vim: Fix cursor restoration when undoing substitute 2023-06-26 20:22:24 -06:00
Conrad Irwin 04a35ae515 vim: Fix scrolling
After #2641 we noticed that scrolling didn't take a count parameter.

The PageDown/PageUp logic was also broken by an additional -1 (for both
vim mode and not).
2023-06-26 13:29:14 -06:00
Conrad Irwin 47563405d7 vim: indent/outdent
Fixes: zed-industries/community#832
2023-06-26 10:08:34 -06:00
Kirill Bulatov 6905a4b3f8 Fix main compilation 2023-06-25 01:43:58 +03:00
Max Brunsfeld 7739da3e85 Vim: substitute support (#2641)
Release Notes:

- vim mode now supports `s` for substitute
2023-06-23 12:58:14 -07:00
Conrad Irwin 99ccf2e91f vim: substitute handles multibyte characters
And is now in its own file
2023-06-22 13:22:19 -06: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
Conrad IrwinandNathan Sobo 59e3cb55a8 Add counts to subsitute (and all)
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-06-22 11:50:56 -06:00
Conrad Irwin 6e93f7407e vim: Support s on selections and with multiple cursors 2023-06-21 15:44:19 -06:00
Conrad Irwin 0d7c2a88ce vim: Add basic 's' support 2023-06-21 15:06:34 -06:00
Conrad Irwin 2d9366839f vim: Allow up/down/left/right in vim mode
The user impact of this is to 5<down> to move 5 lines at a time.
2023-06-21 14:20:39 -06:00
Antonio Scandurra b9bd4b8efb Maintain scroll bottom when streaming assistant responses 2023-06-07 15:01:50 +02:00
Max Brunsfeld b6a053f0d0 Eliminate assets crate 2023-06-06 11:46:46 -07:00