torsteinkrause 路 2022-08-31 19:41
torsteinkrause 路 2022-08-31 19:42
Emacs is a great editor BASH programming! It has code navigation, code completion, inline documentation, integrated debugger and much more.
Slides & conf:
- https://talks.skybert.net/r/2022-emacs-bash-setup/
- https://gitlab.com/skybert/my-little-friends/-/tree/master/emacs
_viz_ 路 2022-09-01 06:21
(I didn't watch the video, only the slides) Note that imenu support OOTB does not understand bash specific function names. It is very easy to add it but I don't know the allowed characters so I haven't submitted a patch to do so (I did for mksh).
As for snippets, sh-mode comes with a healthy amount of skeletons. It even has one for getopt! so you don't need to remember the pesky syntax.
torsteinkrause 路 2022-09-01 07:14
> Note that imenu support OOTB does not understand bash specific
> function names. It is very easy to add it but I don't know the
> allowed characters so I haven't submitted a patch to do so (I did
> for mksh).
I have this in my `.emacs` to allow for `foo.bar()` style function
names, is that what you're thinking about?
https://gitlab.com/skybert/my-little-friends/-/blob/master/emacs/.emacs#L1558
> As for snippets, sh-mode comes with a healthy amount of
> skeletons. It even has one for getopt! so you don't need to remember
> the pesky syntax.
That's cool. I've gotten into the habit of writing the snippets,
myself. That way, I get the names want 馃槃 as well as not giving me
lots of snippets I don't. There are ways around both of these
grievances, I'm sure, but writing the ones I need myself was a fun and
easy exercise that has stuck with me.
_viz_ 路 2022-09-01 07:38
>I have this in my .emacs to allow for foo.bar() style function names, is that what you're thinking about?
More or less. In mksh your function name can be anything except a few exceptions. BTW, it is better to add the bash specific stuff to the bash key so you don't get false positives for other shells (like dash).
>That's cool. I've gotten into the habit of writing the snippets, myself. That way, I get the names want 馃槃 as well as not giving me lots of snippets I don't. There are ways around both of these grievances, I'm sure, but writing the ones I need myself was a fun and easy exercise that has stuck with me.
Those snippets don't do anything unless you explicitly call them. They are under C-c. C-c C-c is case iirc. Skeleton does not work like tempo's tags.
deaddyfreddy 路 2022-09-01 09:59
>the pesky syntax.
that's one of the main problems with using bash for something more complex than oneliners
_viz_ 路 2022-09-01 10:01
No. I mean the getopt syntax specifically.
deaddyfreddy 路 2022-09-01 11:38
I see, my point is still valid, though
Schievel1 路 2022-09-01 17:50
Thanks man that is exactly what I was looking for lately.
Seems like no one cares about bash these days, but it鈥檚 such an important language.
Still it鈥檚 strange to hear bash and IDE in the same sentence :D
torsteinkrause 路 2022-09-01 19:53
I know what you mean. As for important: it's at the core of most businesses I know: without it, products cannot be built, signed and released, without it, the documentation will not be assembled and rolled out, without it, the Docker containers don't have their bootsrap endpoints, without it, DEB and RPM packages don't get their `postinst` and `prerm`s. Without bash your Kubernetes cluster doesn't get an inch passed a boat load of YAML files.
At the same time, coders forget everything they've learned about programming: No modularization, no functions, no re-usable libraries, no unit tests, no release management. Many places, there's even no version control of vital programs for the company's infrastructure. "It's just a shell script" is a mindset that's hard to shake.
torsteinkrause 路 2022-09-01 19:58
> Those snippets don't do anything unless you explicitly call them.
I would think they would be included in completion lists, that's been my experience earlier and I've thus not loaded any of such snippet sets. If this is no longer case, that's a good thing.