Emacs重复字符串n次

编程入门 行业动态 更新时间:2024-10-26 02:32:32
本文介绍了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:

Cx ( bla Cu 5 Cx )

C-x (bla C-u5C-x)

更多推荐

Emacs重复字符串n次

本文发布于:2023-11-30 01:08:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648212.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   Emacs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!