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)).
This commit is contained in:
commit
460bf93866
11 changed files with 377 additions and 60 deletions
|
@ -167,15 +167,25 @@ impl NeovimConnection {
|
|||
.await
|
||||
.expect("Could not get neovim window");
|
||||
|
||||
if !selection.is_empty() {
|
||||
panic!("Setting neovim state with non empty selection not yet supported");
|
||||
}
|
||||
let cursor = selection.start;
|
||||
nvim_window
|
||||
.set_cursor((cursor.row as i64 + 1, cursor.column as i64))
|
||||
.await
|
||||
.expect("Could not set nvim cursor position");
|
||||
|
||||
if !selection.is_empty() {
|
||||
self.nvim
|
||||
.input("v")
|
||||
.await
|
||||
.expect("could not enter visual mode");
|
||||
|
||||
let cursor = selection.end;
|
||||
nvim_window
|
||||
.set_cursor((cursor.row as i64 + 1, cursor.column as i64))
|
||||
.await
|
||||
.expect("Could not set nvim cursor position");
|
||||
}
|
||||
|
||||
if let Some(NeovimData::Get { mode, state }) = self.data.back() {
|
||||
if *mode == Some(Mode::Normal) && *state == marked_text {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue