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

查看:378
本文介绍了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'.

'

推荐答案

一种方法是通过键盘宏

Cx bla Cx Cu 4 Cx e

C-x (bla C-x)C-u4C-xe

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

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

< kbd> Cx bla Cu 5 Cx

C-x (bla C-u5C-x)

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

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