在 Emacs 中通过 shell 命令过滤文本 [英] Filtering text through a shell command in Emacs

查看:22
本文介绍了在 Emacs 中通过 shell 命令过滤文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 vi[m] 中有 ! 命令让我通过 shell 命令管道文本——比如排序或缩进——并将过滤后的文本放回缓冲区.emacs 中是否有等价物?

In vi[m] there is the ! command which lets me pipe text through a shell command -- like sort or indent -- and get the filtered text back into the buffer. Is there an equivalent in emacs?

推荐答案

您可以选择一个地区并输入`C-u M-|命令 RET',由于 shell-command-on-region 的交互前缀参数,它将区域替换为同一缓冲区中的命令输出.

You can select a region and type `C-u M-| command RET', and it replaces the region with the command output in the same buffer due to the interactive prefix argument of shell-command-on-region.

这篇关于在 Emacs 中通过 shell 命令过滤文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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