Commit Graph

403 Commits

Author SHA1 Message Date
Conrad Irwin
f09da1a1c8
vim hml (#7298)
- Add a setting for `vertical_scroll_offset`
- Fix H/M/L in vim with scrolloff



Release Notes:

- Added a settings for `vertical_scroll_offset`
- vim: Fix H/M/L with various values of vertical_scroll_offset

---------

Co-authored-by: Vbhavsar <vbhavsar@gmail.com>
Co-authored-by: fdionisi <code@fdionisi.me>
2024-02-02 19:24:36 -07:00
WindSoilder
430f5d5d53
vim: Convert from visual mode to normal mode with a single click (#6985)
Release Notes:

- Fixed #4319

Here is a demo after the fix:

https://github.com/zed-industries/zed/assets/22256154/a690f146-73c9-4b0e-8527-e4faf690cca2

Actually I'm not really sure should I submit my idea to discussion,
since it's not a large change, and it's something like a bug fix. So I
directly create a pr here.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-02-02 16:44:47 -07:00
Kirill Bulatov
944a1f8fb0
Send lsp_types::InitializeParams with Zed version (#7216)
Based on the great work in
https://github.com/zed-industries/zed/pull/7130 , now sends this data

```
[crates/lsp/src/lsp.rs:588] ClientInfo { name: name.to_string(), version: Some(version.to_string()) } = ClientInfo {
    name: "Zed Dev",
    version: Some(
        "0.122.0",
    ),
}
```

with every LSP server initialization.

Release Notes:

- Added Zed name and version to LSP InitializeParams requests
2024-02-01 18:39:28 +02:00
Vishal Bhavsar
ebdabb907a
vim: Support counts for H and L motions (#7149)
Release Notes:

- Added support for counts to `H` and `L` motions
([#4941](https://github.com/zed-industries/zed/issues/4941)).
2024-01-31 11:50:08 -07:00
Marshall Bowers
dbb5fad147
Fix some formatting issues in Cargo.toml files (#7127)
This PR fixes some formatting issues in some of the `Cargo.toml` files.

I tried to fix most of these in #7126, but there were a few that I
missed.

Release Notes:

- N/A
2024-01-30 22:01:35 -05:00
Marshall Bowers
e338f34097
Sort dependencies in Cargo.toml files (#7126)
This PR sorts the dependency lists in our `Cargo.toml` files so that
they are in alphabetical order.

This should make them easier to visually scan when looking for a
dependency.

Apologies in advance for any merge conflicts 🙈 

Release Notes:

- N/A
2024-01-30 21:41:29 -05:00
Piotr Osiewicz
e6ebe7974d
gpui: Add Global marker trait (#7095)
This should prevent a class of bugs where one queries the wrong type of
global, which results in oddities at runtime.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-01-30 14:08:20 -05:00
Thorsten Ball
7b8bd97652
vim: implement <space> in normal mode (#7011)
This fixes #6815 by implementing `<space>` in normal mode in Vim. Turns
out that `<space>` behaves like a reverse `<backspace>` (which we
already had): it goes to the right and, if at end of line, to the next
line.

That means I had to touch `movement::right`, which is used in a few
places, but it's documentation said that it would go to the next line,
which it did *not*. So I changed the behaviour.

But I would love another pair of eyes on this, because I don't want to
break non-Vim behaviour.

Release Notes:

- Added support for `<space>` in Vim normal mode: `<space>` goes to the
right and to next line if at end of line.
([#6815](https://github.com/zed-industries/zed/issues/6815)).
2024-01-30 10:47:39 +01:00
Thorsten Ball
cddc0fbf92
vim: fix t not being repeatable with , (#7007)
This fixes `t` not being repeatable with `,` and `;` in normal mode.

Release Notes:

- Fixed `t` in Vim mode not being repeatable with `,` or `;`.

---------

Co-authored-by: Conrad <conrad@zed.dev>
2024-01-30 09:17:19 +01:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
Vishal Bhavsar
31e9526544
vim: Add support for moving to first, middle and last visible lines (H, L, M) (#6919)
This change implements the vim
[motion](https://github.com/vim/vim/blob/master/runtime/doc/motion.txt)
commands to move the cursor to the top, middle and bottom of the visible
view. This feature is requested in
https://github.com/zed-industries/zed/issues/4941.

This change takes inspiration from
[crates/vim/src/normal/scroll.rs](https://github.com/zed-industries/zed/blob/main/crates/vim/src/normal/scroll.rs).

A note on the behavior of these commands: Because
`NeovimBackedTestContext` requires compatibility with nvim, the current
implementation causes slightly non-standard behavior: it causes the
editor to scroll a few lines. The standard behavior causes no scrolling.
It is easy enough to account for the margin by adding
`VERTICAL_SCROLL_MARGIN`. However, doing so will cause test failures due
to the disparity between nvim and zed states. Perhaps
`NeovimBackedTestContext` should have a switch to be more tolerant for
such cases.

Release Notes:

- Added support for moving to top, middle and bottom of the screen in
vim mode (`H`, `M`, and `L`)
([#4941](https://github.com/zed-industries/zed/issues/4941)).
2024-01-29 20:58:24 -07:00
Piotr Osiewicz
5ab715aac9 text: Wrap BufferId into a newtype 2024-01-29 20:00:47 +01:00
Conrad Irwin
331b6e7e6e
Support "dtx" vim key combination when "x" is immediately to the right of the cursor (#6830)
Closes #4358

The bug originates on this line:
5db7e8f89e/crates/vim/src/motion.rs (L451)

- When running "dtx" on "ˇabcx", the range to delete is 0 -> 2 ("abc")
- When running "dtx" on "abˇcx", the range to delete is 2 -> 2 ("c"), so
`new_point == point` and the function incorrectly returns `None` and "c"
is not deleted
- We need to disambiguate between the "not found" case and the "found
immediately to the right" case
- This bug does not apply to the backwards case ("dTx")

Release Notes:
- Fixed "dtx" vim key combination when "x" is immediately to the right
of the cursor (#4358)
2024-01-28 19:46:14 -07:00
Brooks Swinnerton
52f7f2d770
Update name of function to match other implementation 2024-01-28 15:20:50 -05:00
Brooks Swinnerton
c0c0abae56
Add support for u and U in vim visual mode 2024-01-28 15:13:09 -05:00
Piotr Osiewicz
0a0a866dd5
Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535)
Release Notes:
- N/A
2024-01-27 13:51:16 +01:00
Brian Strauch
5b9f15e075 add test_data 2024-01-26 20:02:59 -08:00
Brian Strauch
f369e9a48b vim: fix dtx when x is immediately to the right 2024-01-26 16:58:48 -08:00
Thorsten Ball
8d2a401f09 Fix panic when typing umlauts in command palette using Vim mode
Co-Authored-By: Antonio <antonio@zed.dev>
2024-01-26 10:57:14 +01:00
Conrad Irwin
d519fc6b02 Vim :% and :0
Fixes #4303
2024-01-25 19:15:45 -07:00
Joseph T. Lyons
40dbe15b2a Update all links point to community 2024-01-24 15:11:17 -05:00
Piotr Osiewicz
f2ff7fa4d5
chore: Change AGPL-licensed crates to GPL (except for collab) (#4231)
- [x] Fill in GPL license text.
- [x] live_kit_client depends on live_kit_server as non-dev dependency,
even though it seems to only be used for tests. Is that an issue?

Release Notes:
- N/A
2024-01-24 00:26:58 +01:00
Piotr Osiewicz
21e6b09361
Remove license-file from Cargo.toml as it is apparently redundant (#4218)
Release Notes:

- N/A
2024-01-23 17:40:30 +01:00
Piotr Osiewicz
678bdddd7d
chore: Add crate licenses. (#4158)
- GPUI and all dependencies: Apache 2
- Everything else: AGPL

Here's a script that I've generated for it:
https://gist.github.com/osiewicz/6afdd6626e517da24a2092807e6f0b6e

Release Notes:
- N/A

---------

Co-authored-by: David <david@zed.dev>
2024-01-23 16:56:22 +01:00
Conrad Irwin
b9c7bafc80 Merge remote-tracking branch 'origin/main' into jk 2024-01-21 22:03:54 -07:00
Conrad Irwin
4143d3a36e Work on tests 2024-01-21 22:00:35 -07:00
Thorsten Ball
29e74a648f
When searching in visual mode switch to normal mode (#4178)
This matches Neovim behaviour by setting the mode to `Normal` when using
search while in visual mode.

Release Notes:

- Fixed Vim mode not switching to normal mode from visual mode when
using search (`/`) while in visual mode.
2024-01-21 08:42:47 +01:00
Mikayla
4184686e8d
Lock down test platform implementation 2024-01-20 15:03:36 -08:00
Thorsten Ball
87be105af7 When searching in visual mode switch to normal mode
This matches Neovim behaviour by setting the mode to `Normal` when using
search while in visual mode.

Co-authored-by: Conrad <conrad@zed.dev>
2024-01-20 16:33:07 +01:00
Conrad Irwin
137e219830
Don't toggle WHOLE_WORD in vim search (#4165)
Fixes */# in visual mode, and avoids setting up irritating state.

[[PR Description]]

Release Notes:

- vim: Improved `*` and `#` to not toggle Zed's search state. Instead we
now use the regex to identify start and end of words (more like vim).
2024-01-19 15:02:38 -07:00
Max Brunsfeld
9ec6855e6b
Start work on API docs for the language crate (#3981) 2024-01-19 10:04:45 -08:00
Conrad Irwin
0479ebc26d Don't toggle WHOLE_WORD in vim search
Fixes */# in visual mode, and avoids setting up irritating state.
2024-01-19 10:58:55 -07:00
Marshall Bowers
01f06f96a1
Update tenses of doc comment summary lines (#4161)
This PR updates the tenses used by the summary line of doc comments to
match the [Rust API documentation
conventions](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#summary-sentence).

Specifically:

> The summary line should be written in third person singular present
indicative form. Basically, this means write ‘Returns’ instead of
‘Return’.

I'm sure there are plenty occurrences that I missed.

Release Notes:

- N/A
2024-01-19 11:18:50 -05:00
Max Brunsfeld
b65cf6d2d9 Merge branch 'main' into language-api-docs 2024-01-18 15:06:45 -08:00
Conrad Irwin
4e118f3dd7 Fix some cases of broken repeat in vim 2024-01-18 13:20:08 -07:00
Joseph T. Lyons
b807e6fe80 Use try_global() 2024-01-18 01:33:30 -05:00
Mikayla Maki
aa7351041d
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 Osiewicz
6cbc49e5f0
Editor docs (#4097)
Release Notes:

- N/A

---------

Co-authored-by: Kirill <kirill@zed.dev>
2024-01-18 00:48:37 +01:00
Mikayla
e6ca92ffa4
Fix a few more typos 2024-01-17 14:58:58 -08:00
Mikayla
9a7d2e3fe4
fmt 2024-01-17 14:44:10 -08:00
Mikayla Maki
0711476fd5
Merge branch 'main' into fix-typos 2024-01-17 14:36:03 -08:00
Mikayla
57400e9687
Fix typos detected by crate-ci/typos 2024-01-17 14:31:21 -08:00
Marshall Bowers
4e4a1e0dd1
Document the public interface of the vim crate (#4093)
This PR documents the public interface of the `vim` crate.

Release Notes:

- N/A

---------

Co-authored-by: Conrad <conrad@zed.dev>
2024-01-17 13:32:38 -05:00
Max Brunsfeld
6457ccf9ec Add docs for buffer.rs
Co-authored-by: Antonio <antonio@zed.dev>
2024-01-17 10:08:42 -08:00
Thorsten Ball
04922d649c Fix missing Ctrl-[ bindings in Vim mode
This "adds" the keybindings I was missing in Vim mode (e.g. `Ctrl-[` to
cancel a selection) by fixing the definitions in the keymap from
`Ctrl+[` to `Ctrl-[`.
2024-01-17 12:22:05 +01:00
Kirill Bulatov
7b3e7ee3cc Enfoce no dbg! and todo! in Rust code via clippy lints in the CI job 2024-01-11 00:26:46 +02:00
Conrad Irwin
5dff458014
Ensure focus_in and focus_out fire on window activation (#3993)
Also:
- Rename cx.on_blur to cx.on_focus_lost
- Fix a bug where notify calls in focus handlers were ignored
- Fix a bug where vim would get stuck in the wrong mode when switching
  windows

Release Notes:

- (preview only) vim: fix switching between multiple windows
2024-01-10 10:00:07 -07:00
Conrad Irwin
5d3f5611e5
guest promotion (#3969)
Release Notes:

- Adds the ability to promote read-only guests to read-write
participants in calls
2024-01-09 22:21:13 -07:00
Conrad Irwin
72c022f413 Ensure focus-sensitive tests have active windows 2024-01-09 21:38:06 -07:00
Conrad Irwin
1bf33b4b61 Ensure focus_in and focus_out fire on window activation
Also:
- Rename cx.on_blur to cx.on_focus_lost
- Fix a bug where notify calls in focus handlers were ignored
- Fix a bug where vim would get stuck in the wrong mode when switching
  windows
2024-01-09 20:55:00 -07:00