mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
special case deleting to end of word in vim
This commit is contained in:
parent
e5d05afafb
commit
5c7bbe2e59
1 changed files with 9 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use yazi_config::keymap::Exec;
|
use yazi_config::keymap::Exec;
|
||||||
|
|
||||||
use crate::input::Input;
|
use crate::input::{op::InputOp, Input};
|
||||||
|
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
end_of_word: bool,
|
end_of_word: bool,
|
||||||
|
|
@ -20,8 +20,14 @@ impl Input {
|
||||||
let snap = self.snap();
|
let snap = self.snap();
|
||||||
let idx = snap.idx(snap.cursor).unwrap_or(snap.len());
|
let idx = snap.idx(snap.cursor).unwrap_or(snap.len());
|
||||||
|
|
||||||
let step =
|
let step = Self::find_word_boundary(
|
||||||
Self::find_word_boundary(snap.value[idx..].chars(), opt.end_of_word, opt.end_of_word);
|
snap.value[idx..].chars(),
|
||||||
|
// When in vim mode and deleting, we want to skip over the boundary of words.
|
||||||
|
// In other words |A|bcd efg when deleting till the end of the word should be
|
||||||
|
// | |efg as opposed to |d| efg.
|
||||||
|
if let InputOp::Delete(..) = snap.op { false } else { opt.end_of_word },
|
||||||
|
opt.end_of_word,
|
||||||
|
);
|
||||||
self.move_(step as isize)
|
self.move_(step as isize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue