vim: Fix relative line motion
Before this change up and down were in display co-ordinates, after this change they are in fold coordinates (which matches the vim behaviour). To make this work without causing usabliity problems, a bunch of extra keyboard shortcuts now work: - vim: `z {o,c}` to open,close a fold - vim: `z f` to fold current visual selection - vim: `g {j,k,up,down}` to move up/down a display line - vim: `g {0,^,$,home,end}` to get to start/end of a display line Fixes: zed-industries/community#1562
This commit is contained in:
parent
0280d5d010
commit
20aa2a4c54
13 changed files with 580 additions and 67 deletions
|
@ -1,9 +1,14 @@
|
|||
use editor::EditorSettings;
|
||||
use indoc::indoc;
|
||||
use settings::SettingsStore;
|
||||
use std::ops::{Deref, DerefMut, Range};
|
||||
|
||||
use collections::{HashMap, HashSet};
|
||||
use gpui::ContextHandle;
|
||||
use language::OffsetRangeExt;
|
||||
use language::{
|
||||
language_settings::{AllLanguageSettings, LanguageSettings, SoftWrap},
|
||||
OffsetRangeExt,
|
||||
};
|
||||
use util::test::{generate_marked_text, marked_text_offsets};
|
||||
|
||||
use super::{neovim_connection::NeovimConnection, NeovimBackedBindingTestContext, VimTestContext};
|
||||
|
@ -127,6 +132,27 @@ impl<'a> NeovimBackedTestContext<'a> {
|
|||
context_handle
|
||||
}
|
||||
|
||||
pub async fn set_shared_wrap(&mut self, columns: u32) {
|
||||
if columns < 12 {
|
||||
panic!("nvim doesn't support columns < 12")
|
||||
}
|
||||
self.neovim.set_option("wrap").await;
|
||||
self.neovim.set_option("columns=12").await;
|
||||
|
||||
self.update(|cx| {
|
||||
cx.update_global(|settings: &mut SettingsStore, cx| {
|
||||
settings.update_user_settings::<AllLanguageSettings>(cx, |settings| {
|
||||
settings.defaults.soft_wrap = Some(SoftWrap::PreferredLineLength);
|
||||
settings.defaults.preferred_line_length = Some(columns);
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn set_neovim_option(&mut self, option: &str) {
|
||||
self.neovim.set_option(option).await;
|
||||
}
|
||||
|
||||
pub async fn assert_shared_state(&mut self, marked_text: &str) {
|
||||
let neovim = self.neovim_state().await;
|
||||
let editor = self.editor_state();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue