Emacs As A Bash IDE

Torstein Johansen has an interesting video on using Emacs as an IDE for shell programming—especially Bash shell programming. We, or at least I, don’t usually think of shell programming as requiring an IDE but as Johansen shows, a bit of Emacs configuration can significantly ease the task.

He starts off with sh-mode and shows how to adjust the indentation. That gives you syntax highlighting and automatic indentation. Add autocompletion (with Hippie Expand) to help with entering code and navigation (mostly with Projectile) to make finding functions—even if they’re in a different file—easy and you’ve got a good basic Emacs setup for working on shell files but Johansen doesn’t stop there.

He adds LSP and flycheck-mode for advanced navigation and code linting. He shows how to run your script right from Emacs and even how to output an execution trace. He also shows how to run unit tests and perform debugging. Those require adding separate packages and binaries, of course, but if you do a lot of shell programming it’s well worth the effort and space on your system.

Finally, he covers some of the yasnippets that he uses and gives a quick demonstration of git-change-markers. Neither is particular to shell scripts, of course, but they can be useful.

Again, if you regularly work with shell scripts, this video is worth your time. It’s about 18 and a quarter minutes so plan accordingly.

WEATHER UPDATE [2022-09-28 Wed 14:03]: Ian came ashore near Ft. Myers (about 100 miles south of Tampa). Lots of flooding there but things in Tampa are still calm except for moderate, continuous rain. We’re still expecting strong winds and lots more rain as Ian moves up the peninsula.

This entry was posted in General and tagged . Bookmark the permalink.