gpt4 book ai didi

bash - 在 Emacs 中的脚本中着色/缩进脚本

转载 作者:行者123 更新时间:2023-11-29 09:06:15 25 4
gpt4 key购买 nike

我经常有调用其他脚本语言的 shell 脚本,像这样:


#!/bin/bash
cat somefile|awk '
BEGIN
{
#This line is not auto-indented and is colored as a string constant.
...
}
{
#Same with this line.
...
}'

echo "More Bash code here."
...

有没有办法让 Emacs 将 awk 字符串识别为一个 awk 程序,而不仅仅是一个字符串常量?

最佳答案

您需要对现有的 emacs lisp 文件进行自己的扩展。这是一个关于学习 emacs lisp 的有用教程:
http://www.gnu.org/software/emacs/emacs-lisp-intro/

这里是一个给 html 着色的 .el 文件的例子:
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

完成后,将其发布到网上,以便其他人受益!

关于bash - 在 Emacs 中的脚本中着色/缩进脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3789474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com