Commit Graph
1181 Commits
Author SHA1 Message Date
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
Joseph Lyons 4b5a7ec94a Fix typos 2023-06-02 22:02:19 -04:00
Nathan Sobo 2f2061db74 WIP 2023-05-22 23:11:27 -06:00
Max Brunsfeld e7f85efbb8 Rename settings::register_setting -> settings::register 2023-05-17 15:06:11 -07:00
Max Brunsfeld 30e678a450 Remove optional path argument when getting settings 2023-05-17 15:05:20 -07:00
Max Brunsfeld 460d6d652a Define base keymap setting in welcome crate 2023-05-17 11:23:09 -07:00
Max Brunsfeld 56f2ff64ed Define language settings in the language crate 2023-05-16 17:29:53 -07:00
Max Brunsfeld e04be2e2d3 Add a better API for updating settings in the SettingsStore in tests 2023-05-11 17:24:58 -07:00
Max Brunsfeld 876d8b3e09 Ensure the SettingsStore global is added in tests 2023-05-10 16:39:59 -07:00
Max Brunsfeld 47c3504d22 Define vim_mode setting in vim crate 2023-05-10 12:59:24 -07:00
Antonio Scandurra 1703c954bd Avoid calling update_window twice in blurred event handler
This was preventing us from unhooking vim when performing a rename,
which prevented typing in the rename editor.
2023-05-04 16:18:01 +02:00
Antonio Scandurra 51542daadd Filter out vim commands when vim mode is disabled 2023-05-04 14:52:34 +02:00
Antonio Scandurra 1b1f2a3e5e Avoid re-allocating KeymapContext after every view notification 2023-05-04 12:04:30 +02:00
Max BrunsfeldandAntonio Scandurra a0ace48223 Fix vim mode crash when active editor changes in inactive window
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-04-27 10:43:35 -07:00
Antonio Scandurra 2ebdfb9019 Merge remote-tracking branch 'origin/main' into fewer-context-traits 2023-04-26 09:54:58 +02:00
Max Brunsfeld d1f33d7052 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
Antonio ScandurraandNathan Sobo 6a2b4b47ef Remove ReadView and UpdateView traits
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-24 17:36:14 +02:00
Antonio Scandurra b8e92e6d6a Remove stray dbg! statements 2023-04-21 10:49:47 +02:00
Nathan Sobo 49dd95e72e Remove unnecessary replace 2023-04-20 15:26:48 -06:00
Nathan Sobo 8c4db131da Fix remaining vim failures 2023-04-20 15:25:11 -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
Antonio Scandurra 41134f0ebb Make production code compile again 2023-04-17 12:33:33 +02:00
Antonio Scandurra 92cbf44056 Make full-screen and window bounds callbacks take a WindowContext 2023-04-14 11:56:31 +02:00
Nathan Sobo d8eb1ac343 WIP 2023-04-12 10:07:17 -06:00