vim: ctrl-r while we're on a register kick (#13085)
Release Notes: - vim: Support `ctrl-r X` to paste in insert mode (#4308)
This commit is contained in:
parent
e6def62c23
commit
fc19cc0ddf
6 changed files with 122 additions and 83 deletions
|
|
@ -624,7 +624,7 @@ impl Vim {
|
|||
editor: Option<&mut Editor>,
|
||||
cx: &mut WindowContext,
|
||||
) -> Option<Register> {
|
||||
let Some(register) = register else {
|
||||
let Some(register) = register.filter(|reg| *reg != '"') else {
|
||||
let setting = VimSettings::get_global(cx).use_system_clipboard;
|
||||
return match setting {
|
||||
UseSystemClipboard::Always => cx.read_from_clipboard().map(|item| item.into()),
|
||||
|
|
@ -882,8 +882,24 @@ impl Vim {
|
|||
Some(Operator::Mark) => Vim::update(cx, |vim, cx| {
|
||||
normal::mark::create_mark(vim, text, false, cx)
|
||||
}),
|
||||
Some(Operator::Register) => Vim::update(cx, |vim, cx| {
|
||||
vim.select_register(text, cx);
|
||||
Some(Operator::Register) => Vim::update(cx, |vim, cx| match vim.state().mode {
|
||||
Mode::Insert => {
|
||||
vim.update_active_editor(cx, |vim, editor, cx| {
|
||||
if let Some(register) =
|
||||
vim.read_register(text.chars().next(), Some(editor), cx)
|
||||
{
|
||||
editor.do_paste(
|
||||
®ister.text.to_string(),
|
||||
register.clipboard_selections.clone(),
|
||||
false,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
_ => {
|
||||
vim.select_register(text, cx);
|
||||
}
|
||||
}),
|
||||
Some(Operator::Jump { line }) => normal::mark::jump(text, line, cx),
|
||||
_ => match Vim::read(cx).state().mode {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue