22

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?

6 Answers 6

24

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

1

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.

1 Comment

This comment is late, but in Emacs, auto-complete-mode (a minor mode) can be used in addition to sh-mode (the major mode for shell scripting) to provide auto-completion in shell scripts.
1

Another IDE for the VIM world:

Plugin bash-support.vim

screen shots

Help file on-line

Comments

0

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

Comments

-6

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

4 Comments

This kind of answer always sounds strange to me. "How do I accomplish A using tool B?" --- "it's easy, don't use your intended tool B, use this other one C instead". It really doesn't answer the original question at all.
Also, is there any other tool/IDE to make scripting easier on the GNU/Linux Shell? Did you read the question? I think I provided a better solution!
I stand corrected. The original question said "Also, is there any other tool/IDE to make scripting easier on the GNU/Linux Shell?". I sort of vented my frustration about all the answers that don't respond the original question, and sidestep suggesting a new approach.... sorry for that.
I realize that this is an old answer and it technically answers the question. But it unnecessarily hates on emacs while doing so. That part is absolutely not necessary. (And both your alternatives require plugins for bash when emacs has plugins to add the functionality you are missing as well so I don't even see your point)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.