Emacs 重复字符串 n 次

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

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

发布评论

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

>www.elefans.com

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