@@ -2423,7 +2423,7 @@ pub mod cmd {
2423 _args: &[Cow<str>],
2423 _args: &[Cow<str>],
2424 _event: PromptEvent,
2424 _event: PromptEvent,
2425 ) -> anyhow::Result<()> {
2425 ) -> anyhow::Result<()> {
2426− paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard)
2426+ paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard, 1)
2429 fn paste_clipboard_before(
2429 fn paste_clipboard_before(
@@ -2431,7 +2431,7 @@ pub mod cmd {
2431 _args: &[Cow<str>],
2431 _args: &[Cow<str>],
2432 _event: PromptEvent,
2432 _event: PromptEvent,
2433 ) -> anyhow::Result<()> {
2433 ) -> anyhow::Result<()> {
2434− paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard)
2434+ paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard, 1)
2437 fn paste_primary_clipboard_after(
2437 fn paste_primary_clipboard_after(
@@ -2439,7 +2439,7 @@ pub mod cmd {
2439 _args: &[Cow<str>],
2439 _args: &[Cow<str>],
2440 _event: PromptEvent,
2440 _event: PromptEvent,
2441 ) -> anyhow::Result<()> {
2441 ) -> anyhow::Result<()> {
2442− paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection)
2442+ paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection, 1)
2445 fn paste_primary_clipboard_before(
2445 fn paste_primary_clipboard_before(
@@ -2447,7 +2447,7 @@ pub mod cmd {
2447 _args: &[Cow<str>],
2447 _args: &[Cow<str>],
2448 _event: PromptEvent,
2448 _event: PromptEvent,
2449 ) -> anyhow::Result<()> {
2449 ) -> anyhow::Result<()> {
2450− paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection)
2450+ paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection, 1)
2453 fn replace_selections_with_clipboard_impl(
2453 fn replace_selections_with_clipboard_impl(
@@ -4586,11 +4586,12 @@ fn paste_impl(
4586 doc: &mut Document,
4586 doc: &mut Document,
4587 view: &View,
4587 view: &View,
4588 action: Paste,
4588 action: Paste,
4589) -> Option<Transaction> {
4590) -> Option<Transaction> {
4590 let repeat = std::iter::repeat(
4591 let repeat = std::iter::repeat(
4593− .map(|value| Tendril::from_slice(value))
4594+ .map(|value| Tendril::from(value.repeat(count)))
4594 .unwrap(),
4595 .unwrap(),
@@ -4605,7 +4606,7 @@ fn paste_impl(
4605 let mut values = values
4606 let mut values = values
4607 .map(|value| REGEX.replace_all(value, doc.line_ending.as_str()))
4608 .map(|value| REGEX.replace_all(value, doc.line_ending.as_str()))
4608− .map(|value| Tendril::from(value.as_ref()))
4609+ .map(|value| Tendril::from(value.as_ref().repeat(count)))
4609 .chain(repeat);
4610 .chain(repeat);
4611 let text = doc.text();
4612 let text = doc.text();
@@ -4625,7 +4626,7 @@ fn paste_impl(
4625 // paste append
4626 // paste append
4626 (Paste::After, false) => range.to(),
4627 (Paste::After, false) => range.to(),
4628− (pos, pos, Some(values.next().unwrap()))
4629+ (pos, pos, values.next())
4631 Some(transaction)
4632 Some(transaction)
@@ -4635,13 +4636,14 @@ fn paste_clipboard_impl(
4635 editor: &mut Editor,
4636 editor: &mut Editor,
4636 action: Paste,
4637 action: Paste,
4637 clipboard_type: ClipboardType,
4638 clipboard_type: ClipboardType,
4638) -> anyhow::Result<()> {
4640) -> anyhow::Result<()> {
4639 let (view, doc) = current!(editor);
4641 let (view, doc) = current!(editor);
4641 match editor
4643 match editor
4642 .clipboard_provider
4644 .clipboard_provider
4643 .get_contents(clipboard_type)
4645 .get_contents(clipboard_type)
4644− .map(|contents| paste_impl(&[contents], doc, view, action))
4646+ .map(|contents| paste_impl(&[contents], doc, view, action, count))
4646 Ok(Some(transaction)) => {
4648 Ok(Some(transaction)) => {
4647 doc.apply(&transaction, view.id);
4649 doc.apply(&transaction, view.id);
@@ -4654,22 +4656,43 @@ fn paste_clipboard_impl(
4656fn paste_clipboard_after(cx: &mut Context) {
4658fn paste_clipboard_after(cx: &mut Context) {
4657− let _ = paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Clipboard);
4659+ let _ = paste_clipboard_impl(
4662+ ClipboardType::Clipboard,
4660fn paste_clipboard_before(cx: &mut Context) {
4667fn paste_clipboard_before(cx: &mut Context) {
4661− let _ = paste_clipboard_impl(cx.editor, Paste::Before, ClipboardType::Clipboard);
4668+ let _ = paste_clipboard_impl(
4671+ ClipboardType::Clipboard,
4664fn paste_primary_clipboard_after(cx: &mut Context) {
4676fn paste_primary_clipboard_after(cx: &mut Context) {
4665− let _ = paste_clipboard_impl(cx.editor, Paste::After, ClipboardType::Selection);
4677+ let _ = paste_clipboard_impl(
4680+ ClipboardType::Selection,
4668fn paste_primary_clipboard_before(cx: &mut Context) {
4685fn paste_primary_clipboard_before(cx: &mut Context) {
4669− let _ = paste_clipboard_impl(cx.editor, Paste::Before, ClipboardType::Selection);
4686+ let _ = paste_clipboard_impl(
4689+ ClipboardType::Selection,
4672fn replace_with_yanked(cx: &mut Context) {
4694fn replace_with_yanked(cx: &mut Context) {
4695+ let count = cx.count();
4673 let reg_name = cx.register.unwrap_or('"');
4696 let reg_name = cx.register.unwrap_or('"');
4674 let (view, doc) = current!(cx.editor);
4697 let (view, doc) = current!(cx.editor);
4675 let registers = &mut cx.editor.registers;
4698 let registers = &mut cx.editor.registers;
@@ -4679,12 +4702,12 @@ fn replace_with_yanked(cx: &mut Context) {
4679 let repeat = std::iter::repeat(
4702 let repeat = std::iter::repeat(
4682− .map(|value| Tendril::from_slice(value))
4705+ .map(|value| Tendril::from_slice(&value.repeat(count)))
4683 .unwrap(),
4706 .unwrap(),
4685 let mut values = values
4708 let mut values = values
4687− .map(|value| Tendril::from_slice(value))
4710+ .map(|value| Tendril::from_slice(&value.repeat(count)))
4688 .chain(repeat);
4711 .chain(repeat);
4689 let selection = doc.selection(view.id);
4712 let selection = doc.selection(view.id);
4690 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
4713 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
@@ -4704,6 +4727,7 @@ fn replace_with_yanked(cx: &mut Context) {
4704fn replace_selections_with_clipboard_impl(
4727fn replace_selections_with_clipboard_impl(
4705 editor: &mut Editor,
4728 editor: &mut Editor,
4706 clipboard_type: ClipboardType,
4729 clipboard_type: ClipboardType,
4707) -> anyhow::Result<()> {
4731) -> anyhow::Result<()> {
4708 let (view, doc) = current!(editor);
4732 let (view, doc) = current!(editor);
@@ -4711,7 +4735,11 @@ fn replace_selections_with_clipboard_impl(
4711 Ok(contents) => {
4735 Ok(contents) => {
4712 let selection = doc.selection(view.id);
4736 let selection = doc.selection(view.id);
4713 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
4737 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
4714− (range.from(), range.to(), Some(contents.as_str().into()))
4741+ Some(contents.repeat(count).as_str().into()),
4717 doc.apply(&transaction, view.id);
4745 doc.apply(&transaction, view.id);
@@ -4723,21 +4751,22 @@ fn replace_selections_with_clipboard_impl(
4725fn replace_selections_with_clipboard(cx: &mut Context) {
4753fn replace_selections_with_clipboard(cx: &mut Context) {
4726− let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Clipboard);
4754+ let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Clipboard, cx.count());
4729fn replace_selections_with_primary_clipboard(cx: &mut Context) {
4757fn replace_selections_with_primary_clipboard(cx: &mut Context) {
4730− let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Selection);
4758+ let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Selection, cx.count());
4733fn paste_after(cx: &mut Context) {
4761fn paste_after(cx: &mut Context) {
4762+ let count = cx.count();
4734 let reg_name = cx.register.unwrap_or('"');
4763 let reg_name = cx.register.unwrap_or('"');
4735 let (view, doc) = current!(cx.editor);
4764 let (view, doc) = current!(cx.editor);
4736 let registers = &mut cx.editor.registers;
4765 let registers = &mut cx.editor.registers;
4738 if let Some(transaction) = registers
4767 if let Some(transaction) = registers
4739 .read(reg_name)
4768 .read(reg_name)
4740− .and_then(|values| paste_impl(values, doc, view, Paste::After))
4769+ .and_then(|values| paste_impl(values, doc, view, Paste::After, count))
4742 doc.apply(&transaction, view.id);
4771 doc.apply(&transaction, view.id);
4743 doc.append_changes_to_history(view.id);
4772 doc.append_changes_to_history(view.id);
@@ -4745,13 +4774,14 @@ fn paste_after(cx: &mut Context) {
4747fn paste_before(cx: &mut Context) {
4776fn paste_before(cx: &mut Context) {
4777+ let count = cx.count();
4748 let reg_name = cx.register.unwrap_or('"');
4778 let reg_name = cx.register.unwrap_or('"');
4749 let (view, doc) = current!(cx.editor);
4779 let (view, doc) = current!(cx.editor);
4750 let registers = &mut cx.editor.registers;
4780 let registers = &mut cx.editor.registers;
4752 if let Some(transaction) = registers
4782 if let Some(transaction) = registers
4753 .read(reg_name)
4783 .read(reg_name)
4754− .and_then(|values| paste_impl(values, doc, view, Paste::Before))
4784+ .and_then(|values| paste_impl(values, doc, view, Paste::Before, count))
4756 doc.apply(&transaction, view.id);
4786 doc.apply(&transaction, view.id);
4757 doc.append_changes_to_history(view.id);
4787 doc.append_changes_to_history(view.id);