Emacs 重复字符串 n 次 [英] Emacs repeat string n times

查看:27
本文介绍了Emacs 重复字符串 n 次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习在 Emacs 中导航/编辑的基础知识,我很好奇如何完成以下任务:

I'm learning the basics of navigating/editing in Emacs and I'm curious how one could accomplish the following task:

  • 在普通文本编辑模式下重复字符串 'bla' n 次.

假设我想重复五次以生成bla bla bla bla bla".我试过了……

Let's say I want to repeat it five times to generate 'bla bla bla bla bla '. I tried...

C-u 5 bla

...但是输入'b'后命令执行,我只得到'bbbbb'.

...but the command executes after the 'b' is entered, and I only get 'bbbbb'.

我敢肯定这里有一些基本命令可以帮助我...有人能启发我吗:)?

I'm sure there's some basic command that can help me here...would somebody be kind enough to enlighten me :)?

推荐答案

一种方法是通过 键盘宏:

Cx (bla Cx)Cu4Cxe

您也可以在宏终止之前插入重复计数:

You can also just insert the repeat count before the macro termination:

C-x (bla C-u5C-x)

这篇关于Emacs 重复字符串 n 次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆