IDE / Emacs 模式用于 Bash/Sh 等中的 Shell 脚本编写

发布于 2024-07-25 00:37:39 字数 199 浏览 15 评论 0原文

我使用 Emacs 来编写 shell 脚本。 我知道我在某处读到有一些模式可以让在 Emacs 上编写 Shell 脚本变得更容易(代码完成、自动完成、括号匹配、语法高亮、检查语法),但一直没找到。 简而言之,我想把 Emacs 变成一个 Bash IDE。

另外,是否有其他工具/IDE 可以使 GNU/Linux Shell 上的脚本编写变得更容易?

I use Emacs for shell scripts. I know I read somewhere there's some mode to make it easier (code completion, autocomplete, bracket matching, syntax highligting, check syntax) to write Shell scripts on Emacs but haven't been able to find it. In short, I would like to turn Emacs into a Bash IDE.

Also, is there any other tool/IDE to make scripting easier on the GNU/Linux Shell?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

离鸿 2024-08-01 00:37:39

嗯,有一个内置的 shell 模式可以进行语法突出显示,如果尚未打开,Mx shell-script-mode 将为您完成此操作。

关于使脚本编写更容易的工具。 有一个 bash shell 调试器,所以如果你在 bash 中编程,那会有很大帮助。

当然还有 eshell,一个用 Emacs lisp 编写的 shell,这样你就可以获得所有语法高亮显示期望来自 lisp、自动完成和 emacs lisp 调试器。

Well, there's a built-in shell mode that does syntax highlighting, if it's not already turned on, M-x shell-script-mode will do it for you.

Regarding a tool to make scripting easier. There's a bash shell debugger, so if you program in bash, that would help quite a bit.

Of course there's eshell, a shell written in Emacs lisp, so you can get all the syntax highlighting you'd expect from lisp, the auto-completion, and the emacs lisp debugger.

这个俗人 2024-08-01 00:37:39

我认为 shell 脚本没有任何代码完成模式,至少在 Emacs 中没有。 (实际上我从来没有感觉到有必要。)但是,bash 在交互运行时支持完成(该包称为“bash-completion”或类似的东西)。 这为许多 shell 命令提供了制表符补全功能。

I don't think there is any mode for code completion for shell-scripts, at least not in Emacs. (I've actually never felt the need.) However, there is support in bash for completion when running interactively (the package is called "bash-completion", or something similar). This provides tab-completion for many shell-commands.

爱的那么颓废 2024-08-01 00:37:39

VIM 世界的另一个 IDE:

插件 bash-support.vim

< a href="http://lug.fh-swf.de/vim/vim-bash/screenshots-en.html" rel="nofollow noreferrer">屏幕截图

在线帮助文​​件

Another IDE for the VIM world:

Plugin bash-support.vim

screen shots

Help file on-line

自此以后,行同陌路 2024-08-01 00:37:39

我知道这是旧帖子,但我想分享我的设置。

我遇到了同样的问题,现在我在 .emacs 文件中使用下面的代码来自动完成 sh/bash 代码。

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)

如果您使用最新版本的 Emacs,语法突出显示应该已经可以使用。

I know it is old post, but i will like to share my settings.

I had the same issue and now I use the code below in my .emacs file for sh/bash code autocompletion.

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)

The syntax highlighting should already work if you use a recent version of Emacs.

执着的年纪 2024-08-01 00:37:39

Griffon 是专门为 BASH 脚本设计的 IDE。 其功能包括自动完成、语法突出显示、错误检测等。

Griffon is an IDE specifically designed for BASH scripting. Its features include autocomplete, syntax highlighting, error detection, and more.

醉南桥 2024-08-01 00:37:39

我对Emacs不是很熟悉,但我相信它不太方便。 正如我所看到的,好的ide总是可以做到:

  1. 跳转到声明
  2. 查找引用
  3. 代码大纲和代码大纲 显示符号
  4. 突出显示出现情况
  5. 代码完成

因此,我会推荐 Jetbrain Idea(带有 bashsupport 插件)和 Visual Studio Code(带有 bash ide 和 shell 格式扩展)。

ps:

bashsupport - https://plugins.jetbrains.com/plugin/4230-bashsupport/< /a>

bash ide - https://marketplace.visualstudio。 com/items?itemName=mads-hartmann.bash-ide-vscode

I am not very familiar to Emacs, but I believe it's not convenient. As I see, good ide always can do:

  1. Jump to declaration
  2. Find references
  3. Code Outline & Show Symbols
  4. Highlight occurrences
  5. Code completion

So I will recommend Jetbrain Idea(with bashsupport plugin) and Visual Studio Code(with bash ide and shell-format extension).

ps:

bashsupport - https://plugins.jetbrains.com/plugin/4230-bashsupport/

bash ide - https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文