Bash editor?



  • I'm beginning to take my bash scripts more seriously, thus the search for a decent bash editor.

    I suspect most bash gurus use vim or emacs beefed up to the max, but I'm not getting into CLI editors.

    So far, I've used Sublime Text, but bash syntax highlighting is far from perfect in that one, and can sometimes bleed all over in more complex scripts.

    Occasionally, I edit a bash script in one of JetBrains editors, but shell support there seems like an afterthought. Not to mention all the other baggage they bring.

    Surprisingly, it doesn't seem like anyone gave bash or shell editing in general any serious attention. It is always a module or sideshow, while some other language is the prime target.

    So, what are you using? Any gem I've missed?



  • I use Nano. Or I use Notepad++ on Windows and SCP it over to the Linux box.


    Filed Under: This post not guaranteed to be helpful in any manner.


  • Winner of the 2016 Presidential Election

    Notepad++ doesn't seem to have Bash in its language list, strangely


  • Discourse touched me in a no-no place

    @cartman82 said:

    I'm beginning to take my bash scripts more seriously, thus the search for a decent bash editor.

    I suspect most bash gurus use vim or emacs beefed up to the max, but I'm not getting into CLI editors.

    You're willing to put time and effort into learning bash, but not into learning a CLI editor?

    OP is TRWTF.



  • @mott555 said:

    I use Nano. Or I use Notepad++ on Windows and SCP it over to the Linux box.

    Crappy editor and windows editor?

    Just as I thought, there's a serious vacuum in the market there.



  • @cartman82 said:

    Just as I thought, there's a serious vacuum in the market there.

    There may be a couple good ones out there, but they're lost in the 189287234985978091746 open-source Linux text editors and I don't have time to try a bunch out and see which are the good ones. So I stick with what I know, which happens to be Nano or something on Windows.



  • @antiquarian said:

    You're willing to put time in effort into learning bash, but not into learning a CLI editor?

    OP is TRWTF.

    Learning emacs or vim would take too much time with too little payoff. It's not like those skills are transferable to other editors you're using every day (browser textboxes, emails, Word, other windows programs, most IDE-s). They might even hinder you if you get too comfortable.

    I can get by without vim. I'm more limited with bash, given the kind of environments I work in.


  • mod

    @mott555 said:

    I use Nano.

    Ditto, because if I do anything more complex than a few lines I use perl, which has decent notepad++ support. I've been meaning to learn python for this niche instead, but it's on my todo list.



  • IMHO, bash scripts should never be complex enough that you need a good editor for them. So just standard Kate/Gedit.



  • Not only that, but suggesting Notepad++ over Sublime Text is doing it wrong (real version, not jeff version).

    If you really wanted to, you could probably futz around with the syntax highlighting in Sublime.



  • Yeah, I'm in an awkward situation where my bash code has grown to the size I need a good editor, but I don't have enough time to switch everything over to pearl or python. Yes, I looked into that.... it's just too much effort to replace something that already works.



  • I downloaded Sublime, but it's like 15x slower than Notepad++ at everything so I haven't given it much use yet. And paying for a text editor feels like Doing It Wrong™.



  • I generally use Kate. It seems to have decent highlighting, at least. It's a good editor, and has some IDE-like extensions and whatnot, though I haven't used too many of them.


  • mod

    I'd suggest Sublime, it's definitely slick. We use it at work, I just haven't felt like buying a license for the small amount of editing I do at home when I already have notepad++.

    Derp, I can't read the OP, don't mind me.



  • @hungrier said:

    If you really wanted to, you could probably futz around with the syntax highlighting in Sublime.

    I would be perfectly happy with sublime if they fixed their fucking syntax code.

    I don't want to work on sublime. I want to work on my code.


  • :belt_onion:

    @cartman82 said:

    Learning emacs or vim would take too much time with too little payoff. It's not like those skills are transferable to other editors you're using every day

    Many editors and IDEs provide a "vim mode". Including Sublime through an extension. Forgot what it's called, but it's in package control.


  • mod

    @cartman82 said:

    I would be perfectly happy with sublime if they fixed their fucking syntax code.

    They released Sublime 3 recently, does the problem persist?

    Have you checked for packages that might fix the issue?



  • Alternatively, if TextMate (OSX only IIRC) has working syntax highlighting for Bash scripts, you can use that directly with Sublime.



  • @Onyx said:

    Many editors and IDEs provide a "vim mode". Including Sublime through an extension. Forgot what it's called, but it's in package control.

    Ok, but there's no vim mode for life.

    @Yamikuronue said:

    They released Sublime 3 recently, does the problem persist?

    Have you checked for packages that might fix the issue?

    Yes x 2.
    I'm using their bash plugin. It's just buggy.

    @hungrier said:

    Alternatively, if TextMate (OSX only IIRC) has working syntax highlighting for Bash scripts, you can use that directly with Sublime.

    Needs to be linux-based.



  • @cartman82 said:

    Needs to be linux-based.

    You didn't mention the typical editors that come with a DE: e.g., kate, gedit. Look in your package manager.



  • I mean use the language file from TextMate. Someone on the internet may have already solved this problem, and if so you can use their syntax file in Sublime.


  • Discourse touched me in a no-no place

    @cartman82 said:

    Learning emacs or vim would take too much time with too little payoff. It's not like those skills are transferable to other editors you're using every day (browser textboxes, emails, Word, other windows programs, most IDE-s). They might even hinder you if you get too comfortable.

    I can get by without vim. I'm more limited with bash, given the kind of environments I work in.


    Fine, then stop complaining about the lack of bash support. The target market isn't there for it.


  • :belt_onion:

    @cartman82 said:

    Needs to be linux-based.

    I think he meant to say that syntax definition files are compatible.

    Edit: Hanzo'd!



  • @boomzilla said:

    You didn't mention the typical editors that come with a DE: e.g., kate, gedit. Look in your package manager.

    I have gedit. It has syntax highlighting. And that's it. None of the advanced options from sublime.

    @hungrier said:

    I mean use the language file from TextMate. Someone on the internet may have already solved this problem, and if so you can use their syntax file in Sublime.

    Nice, it seems syntax definitions are compatible. Worth a try.



  • @cartman82 said:

    vim or emacs […] CLI editors

    Both Vim and Emacs have guis for X and Windows. I've been using Vim on console for long time, but I've switched to using it in gui mode when I had to work on Windows and then switched to using it in gui mode on Linux too because it allows more options for highlighting (any color instead of 16 plus bold/italic plus underlining with combining characters). Of course both still do use those funky keyboard shortcuts you may not be keen on learning.


  • Discourse touched me in a no-no place

    Another vote for Kate here. Most of my (plain-text) work is done in it, not just my bash scripts. (I'm largely C-based at work, PHP at home.)



  • @cartman82 said:

    None of the advanced options from sublime.

    I've never used Sublime. What sort of "advanced options" are we talking about?


  • sockdevs

    ViM or death for me.


  • :belt_onion:

    @cartman82 said:

    Yeah, I'm in an awkward situation where my bash code has grown to the size I need a good editor, but I don't have enough time to switch everything over to pearl or python. Yes, I looked into that.... it's just too much effort to replace something that already works.

    I know I'm not really helping with your original question, but if your Bash scripts are that big you might want to switch to Python. Bash does get hairy if you need it that much, and Python + somethin like Ansible might be even better if you start scripting multiple machines.



  • @PJH said:

    Another vote for Kate here. Most of my (plain-text) work is done in it, not just my bash scripts. (I'm largely C-based at work, PHP at home.)

    Ok, kate looks pretty good. For reference, here's the problematic syntax highlighting in sublime...

    ...and in kate...

    Much better.

    Unfortunately, kate doesn't seem to have the super-useful multiple-selection from sublime and other nice stuff. I don't know. I think I'll first give sublime + textmate syntax another try (failed to extract syntax files from the raw download, will probably have to get on mac to do it from the Application Support files).

    @Bulb said:

    Both Vim and Emacs have guis for X and Windows. I've been using Vim on console for long time, but I've switched to using it in gui mode when I had to work on Windows and then switched to using it in gui mode on Linux too because it allows more options for highlighting (any color instead of 16 plus bold/italic plus underlining with combining characters). Of course both still do use those funky keyboard shortcuts you may not be keen on learning.

    Yup, text mode is silly in a GUI, but fine, whatever. Shortcuts are the deal-breaker.

    @boomzilla said:

    I've never used Sublime. What sort of "advanced options" are we talking about?

    There are nice animated demos on the front page.

    @JBert said:

    I know I'm not really helping with your original question, but if your Bash scripts are that big you might want to switch to Python. Bash does get hairy if you need it that much, and Python + somethin like Ansible might be even better if you start scripting multiple machines.

    As mentioned, I already have a ton of code that works. I can't afford to write everything from scratch.

    That said, once I organize and fix all my bash stuff, anything new I'll probably write in python.



  • @cartman82 said:

    There are nice animated demos on the front page.

    Ain't nobody got time for that shit.

    @cartman82 said:

    super-useful multiple-selection

    I've heard of this, but I've never used anything that has it so I'm probably just blubbing on that, but BDGI.



  • It's literally just a click and there is a huge animation playing right in front of you. Unfortunately it's not a gif, otherwise I'd include it here.



  • I recommend scite (scintilla text editor). It's quick to load, formats text in a civilised manner and is the only thing I took away from my first job that doesn't give me flashbacks.



  • @cartman82 said:

    It's literally just a click and there is a huge animation playing right in front of you. Unfortunately it's not a gif, otherwise I'd include it here.

    Now I'm just kind of confused </phil hartman caveman lawyer>. OK, some of that looks like the sort of thing that you get with refactoring tools in an IDE.


  • mod

    I used it today for converting PJH's SQL output into an excel sheet: select all, split into lines, deselect the last half, and copy-paste into word to get column A. repeat with the latter half of each line for column B.

    It's useful in niche circumstances, but once you have it you seem to find them all over the place.



  • @boomzilla said:

    Now I'm just kind of confused </phil hartman caveman lawyer>. OK, some of that looks like the sort of thing that you get with refactoring tools in an IDE.

    Some of it. Some is just a fancy way to do search & replace.
    But my favorite part is vertical editing, which is kind of block select in kate, except you can move freely and it can deal with jagged edges. It's pretty cool once you get used to it.



  • @Yamikuronue said:

    I used it today for converting PJH's SQL output into an excel sheet: select all, split into lines, deselect the last half, and copy-paste into word to get column A. repeat with the latter half of each line for column B.

    Yeah, because you couldn't remember how to use the right tool for the job. :smile:

    @cartman82 said:

    vertical editing

    Hmm...that's the sort of thing I definitely have a use for.



  • @boomzilla said:

    Hmm...that's the sort of thing I definitely have a use for.

    Eh...and which kate does, though probably not the jagged edges. Guess I need to learn my tools better...


  • :belt_onion:

    @cartman82 said:

    But my favorite part is vertical editing, which is kind of block select in kate, except you can move freely and it can deal with jagged edges. It's pretty cool once you get used to it.

    So...

    </trolololol>



  • @Shoreline said:

    I recommend scite (scintilla text editor). It's quick to load, formats text in a civilised manner and is the only thing I took away from my first job that doesn't give me flashbacks.

    Ugh! First, whose idea was to use variable width font in a code editor!?

    Much better. You know it's an open source project when the first thing you do is find a way to edit their obscure non-standard configuration files so you can change the crazy defaults preferred by the neckbeards in charge.

    But so far looks like a diamond in the rough. I'll give it a chance.



  • @Onyx said:

    So...
    </trolololol>

    What!? You managed to copy-paste my post into vim? What wizardry is this!?

    Seriously, I dig the theme. Very nice. Now if only it had normal workflow.


  • sockdevs

    @cartman82 said:

    Now if only it had normal workflow.

    it does! it's very normal, just not standardixed for a world in which mice are a thing.


  • :belt_onion:

    Works in bash, too, actually, and some other popular shells:

    Too bad it doesn't work trough ssh it would seem. Then again, I didn't even try and get it working.

    If anyone is interested.


  • Discourse touched me in a no-no place

    @cartman82 said:

    What!? You managed to copy-paste my post into vim? What wizardry is this!?

    Are you the type of person who, when they visit another country, only goes to the touristy spots and makes every effort to avoid learning anything substantial about the culture?



  • @antiquarian said:

    Are you the type of person who, when they visit another country, only goes to the touristy spots and makes every effort to avoid learning anything substantial about the culture?

    I don't often visit other countries. But if I do, I make sure to offend them and let them know how little I think of their culture and how much I find my own superior.

    Uh! Uh! Since you asked me a completely pointless and off-topic question, I want to ask a question too!

    Are you the type of person who, while bored on the toilet, looks at bathroom tiles and imagines little people living there? And the folk from opposite walls being at war with each other and constantly shooting lasers when angry or bored? And then imagine being one of those little people? And living your life knowing that, at any moment, a laser beam from the enemy wall can randomly hit you and end your life? And there's nothing you can do but drink and shoot your own laser at the other wall, hoping you score a random hit before someone obliterates you?

    Because that how random your crappy comments feel. Get constructive, or get funny, or get out.



  • @Onyx said:

    If anyone is interested.

    Just tried it. Couldn't make it to work. Just feels buggy. Could be my python install, or maybe they expect 3D accel or something.

    Either way, what DID work, seemed kind of sluggish. I probably wouldn't like it.


  • Discourse touched me in a no-no place

    I freely admit my post was over the top, but there's a point behind it. You can do a lot more with vim and emacs than you might think. Both are available for Windows by the way.



  • @antiquarian said:

    I freely admit my post was over the top, but there's a point behind it. You can do a lot more with vim and emacs than you might think. Both are available for Windows by the way.

    I know. My point isn't that they aren't powerful, it's that the workflow is too different from what I'm usually doing. And while I can't insert vim workflow into EVERY program where I edit text, I can certainly find text editors that are just as good as vim, but use the normal workflow. So, IMO, it's just not worth the effort.



  • @cartman82 said:

    I know. My point isn't that they aren't powerful, it's that the workflow is too different from what I'm usually doing. And while I can't insert vim workflow into EVERY program where I edit text, I can certainly find text editors that are just as good as vim, but use the normal workflow. So, IMO, it's just not worth the effort.

    Cartman does have a point here: nobody that I know of has made Word talk Vim or Emacs. On the other hand, something like Geany or Kate has standard-ish-enough keyboard shortcuts that going back and forth between your editor and the rest of the GUI world isn't going to shock you. I use Geany, personally; between it and Kate, though, it's likely a tossup.


  • Discourse touched me in a no-no place

    @cartman82 said:

    I can certainly find text editors that are just as good as vim, but use the normal workflow.

    I use mostly emacs myself, but I know at least one regular here who will be pissed off when she reads this.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.