Commit Graph
55 Commits
Author SHA1 Message Date
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 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 2025d37bb2 vim: Allow ^ as a motion
Fixes: zed-industries/community#856
2023-07-03 12:55:41 -06:00
Conrad Irwin 0feef10a21 vim: ctrl-c to exit visual mode
Fixes: zed-industries/community#1447
Contributes: zed-industries/community#1089
2023-07-03 12:52:33 -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
Nathan Sobo 56c6d840b3 vim: Fix scrolling (#2647)
After #2641 we noticed that scrolling didn't take a count parameter, and
a few other issues with the way that we calculated the distance to
scroll.
 
Release Notes:

- Improved distance calculations for page-up/page-down
- vim: Allow counts to work with scrolling shortcuts.
2023-06-27 04:01:14 -06:00
Nathan Sobo 0f08a5223d vim: shortcuts for tab navigation (#2649)
Release Notes:

- vim: added gt/ctrl-pagedown and gT/ctrl-pageup for tab navigation
2023-06-27 03:57:01 -06:00
Conrad Irwin 19ac999fc4 vim: Fix code actions menu
Fixes: zed-industries/community#1690
2023-06-26 21:46:06 -06:00
Conrad Irwin 72df76d5f0 vim: Add ~ to change case
Fixes: zed-industries/community#1410
2023-06-26 20:22:24 -06:00
Conrad Irwin e6d5841335 vim: shortcuts for tab navigation 2023-06-26 15:07:19 -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
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 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
Nathan Sobo 58c5d3ef11 vim: binding fixes (#2637)
Release Notes:

- In vim mode you can now use count modifiers with arrow keys (`5<down>`
will go down 5 lines).
- In vim mode `ctrl+]` and `ctrl+o` now work to go to definition and
back
2023-06-22 06:44:12 -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 ef79513fc6 vim: ctrl+] and ctrl+o to jump to definition and back
Equivalent to f12 and ctrl-- in non-vim mode.
2023-06-21 14:34:35 -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
Nathan SoboandConrad Irwin 0ea52d851d Add shift-J binding to Vim normal mode
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 11:58:31 -06:00
Petros Amoiridis 4c1be53252 Apply the tab_size change to keymaps and settings 2023-04-20 14:08:30 +03:00
Kay Simmons 07b2eac2a6 add go to definition binding to vim normal mode 2023-02-27 10:23:30 -08:00
Kay Simmons 24a448f00c Fix enter in normal mode acting incorrectly 2023-02-23 13:40:31 -08:00
Kay Simmons 033606fa2e fix sqlez warning, introduce tab and enter bindings to vim for inputing tab and enter text when waiting for text 2023-02-13 13:50:37 -08:00
Kay Simmons ab5653a76f More vim fixes and move some more things out of app.rs 2023-02-13 13:50:37 -08:00
Kay Simmons 0cd5e26029 fix issue with single line editors in vim not properly unhooking vim mode bindings 2023-02-13 13:50:37 -08:00
Kay Simmons 974b07e043 in progress 2023-01-11 12:10:55 -08:00
Kay Simmons 4da1890a54 working f and t bindings 2023-01-06 14:24:20 -08:00
Kay Simmons 242f038bbd fix final failing tests 2022-12-08 14:39:48 -08:00
Kay Simmons acac7d292d Refactor editor scrolling and implement scroll commands from vim mode 2022-12-07 16:39:32 -08:00
K Simmons edc2c90c3e working quote and bracket text objects 2022-10-11 15:17:29 -07:00
K Simmons 713c2c4ae8 fix minor issue where undo is not available in visual mode 2022-10-10 15:34:40 -07:00
K Simmons 055a8fe14a Fixed some neovim test context issues, added repeated commands in vim mode, and ported some tests to use the neovim testing strategy 2022-10-08 21:52:07 -07:00
K Simmons bda6e5fdb7 Adds word and sentence text objects along with a new vim testing system which uses cached neovim data to verify our test accuracy 2022-10-08 21:51:49 -07:00
Antonio Scandurra 6c6189a344 Fix vim keybindings containing the shift modifier
They regressed as part of https://github.com/zed-industries/zed/pull/1405.
2022-07-27 09:31:47 +02:00
Keith Simmons 368cfcaf3c fix pasting at the end of the line in normal mode 2022-07-08 10:57:02 -07:00
Keith Simmons 590ab282a5 WIP making paste better 2022-07-05 16:52:56 -07:00
Keith Simmons 570d69ee5a Highlight matching bracket when newest selection head is on a bracket 2022-07-01 15:06:16 -07:00
Keith Simmons 49d1b87d94 Fix vim editor focus selection issues, cancel vim operators on escape and unbound keys 2022-06-30 12:36:02 -07:00
Keith Simmons 7f12bd6bb0 Add vim bindings for hover
Allow scrolling in hover popover
2022-06-07 13:07:53 -07:00
Keith Simmons b0c5ac1f54 Unify visual line_mode and non line_mode operators 2022-05-26 17:02:05 -07:00
Keith Simmons f053c479e9 Visual line mode handles soft wraps 2022-05-26 17:02:05 -07:00
Keith Simmons 36fa835664 Enable copy and paste in vim mode 2022-05-26 17:02:05 -07:00
Keith Simmons a66cc7c40b Working change and delete in line mode 2022-05-26 17:02:05 -07:00
Keith Simmons be8bfa9592 WIP line mode operations 2022-05-26 17:02:05 -07:00
Keith Simmons cdbad9aee4 Initial visual mode 2022-05-10 11:12:28 -07:00
Keith Simmons 660e3e9ef2 Add insert line above and below 2022-05-02 11:49:10 -07:00