vim: Allow search with operators & visual mode (#10226)
Fixes: #4346 Release Notes: - vim: Add search motions (`/,?,n,N,*,#`) in visual modes and as targets for operators like `d`,`c`,`y` ([#4346](https://github.com/zed-industries/zed/issues/4346)).
This commit is contained in:
parent
f9bf60f017
commit
f327118e06
11 changed files with 316 additions and 36 deletions
|
@ -4,12 +4,22 @@ use gpui::WindowContext;
|
|||
use language::BracketPair;
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum SurroundsType {
|
||||
Motion(Motion),
|
||||
Object(Object),
|
||||
}
|
||||
|
||||
// This exists so that we can have Deserialize on Operators, but not on Motions.
|
||||
impl<'de> Deserialize<'de> for SurroundsType {
|
||||
fn deserialize<D>(_: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
Err(serde::de::Error::custom("Cannot deserialize SurroundsType"))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_surrounds(text: Arc<str>, target: SurroundsType, cx: &mut WindowContext) {
|
||||
Vim::update(cx, |vim, cx| {
|
||||
vim.stop_recording();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue