20

As the title says, I seek high quality text editor for POSIX shell scripting.

Requirements:

  • Most important to me is syntax highlighting:

    • I admire the fast start-up of Sublime Text, but it does not recognize variables inside strings:

      [ -f "${backup_file}" ] && echo "File ${backup_file} exists, exiting." && exit 1
      

      Like in this test case, where it simply fails to highlight variables out of the box at least.

  • Cross-platform, because I work primarily on Windows 10 (running scripts in Cygwin), but also on Linux Mint 19.

  • Although preferred, it does not have to be open-source.

  • I am also willing to pay for it, so it does not have to be free.

  • Must be with graphical user interface, so a CLI editor is a no go.

  • Does not have to be fast, just get me the syntax highlighting of variables and other shell script related things out of the box.


Reference script has been posted inside my own answer on Code Review.


Bottom line

The accepted solution is gVim Easy, because after minor adjustments to my HiDPI display it became the fastest and probably the most powerful editor I have ever seen. I intend to use it in the Easy mode, though, in order to experience normal editing, but later on, I might use the real power of it.


Follow-up

Though, I was astonished by how fast gVim Easy could start up, after two days spent over _vimrc, and setting things up to my expectations, I am a little tired of it, and am not sure it's worth the trouble for me, because I am no heavy editor, I just write shell scripts, and after several hours spent in Visual Studio Code, feeling like at home, I am prepared to say my decision was rather hasty and I am truly contemplating over switching to Visual Studio Code from Sublime Text instead of to gVim for it works out of the box almost perfectly. So far I haven't even made any change to the settings, which I would have to do with gVim Easy whenever re-installing and / or moving to another computer. I am not 100% sure I won't ever use the vim family, but as for this question, for future readers, Visual Studio Code should be recommended, and thus I am accepting that solution.

  • 1
    have you tried the "dotfiles syntax" package with Sublime Text? The line you posted produces this -> i.imgur.com/C2Gu01u.png – defuzed Jul 3 '18 at 12:01
30

Visual Studio Code

Pros:

  • Cross-platform (Windows, Linux, Mac)

  • Open-source, see its GitHub page, though there is some fog about it

  • Free of charge, MIT license

  • Faster than Atom

  • IntelliSense autocomplete

  • Start-up time on Dell 7577-92774: 3 seconds

  • Shell script syntax highlighting with strong color for variables:

  • ShellCheck plugin available, which makes it really strong competitor for shell scripting

  • Integrated Linux terminal, which makes me say wow!

    Code

Cons:

  • Far slower than gVim

  • Slower than Sublime Text

  • For someone it may be off-putting that it comes from Microsoft

  • @hvd Further (slightly-contradictory) discussion here, here and here. – Bob Jul 3 '18 at 7:33
  • VS Code is also incredibly simple to get into and to learn a lot about it quickly – Brian Leishman Jul 3 '18 at 14:52
29

gVim

Pros:

  • Cross platform (Windows, Linux, Mac, Amiga, OS/2, others, even Android and iOS)
  • Open-source, see its GitHub page
  • Free of charge (although it encourages charity donation), GPL license with Charityware
  • Fast and memory efficient
  • Supports both GUI and CLI
  • Mac and Linux users probably have it already installed, except for OP's Linux Mint 19, where it is not installed at all and can be installed as package vim-gtk3
  • Start-up time on Dell 7577-92774: 0.1 seconds
  • Syntax highlighting with strong color for variables (color scheme Atomified):

    gVim screenshot

Cons:

gVim Easy

As vim design is based on vi, it's quite different than most other text editors, so it gained notoriety of being hard to use. There's Easy mode though, that makes vim work more or less like a standard text editor. In this case it is called gVim Easy and in this mode it can be launched simply by adding -y argument.

  • @el.pescado :q should exit it. :q! if you made changes you don't want to save, and :x if you have made changes you do want to save. In GVim I'd expect a corresponding entry in the "File" menu (I never used the GUI variant). – Izzy Jul 2 '18 at 11:06
  • Of course you put set guioptions='' in your gvimrc to hide those pesky task and scrollbars. – Cubic Jul 2 '18 at 11:49
  • There is additional value in learning vi/vim/gvim. First off the vi editor is part of the standard install on almost every unix and unix like os in the known universe -- thus learning vi means you can edit a file in either a GUI or non-GUI environment on any unix box you need to. Secondly the search and replace in vi is VERY close to what is used in sed. So by learning :<range> s/this/that/g in vi you also get some skill transfer to using sed. – Petro Jul 2 '18 at 15:31
  • @Petro One day when I had to use ed ([the standard text editor]gnu.org/fun/jokes/ed-msg.html) I was happy to have used vim before. (Had to use ed because of a broken console) – pipe Jul 3 '18 at 12:03
  • mac most definitely does not have Gvim installed by default. It has "Vim" -- the terminal version. You can install Gvim one of several ways, e.g. through Homebrew or download MacVim – JDS Jul 3 '18 at 14:16
16

Atom

Pros:

  • Cross-platform (Windows, Linux, Mac)

  • Open-source, see its GitHub page

  • Free of charge, MIT license

  • Shell script syntax highlighting with strong color for variables:

    Atom

Cons:

  • Start-up time on Dell 7577-92774: 5 seconds

  • Far, far slower than gVim

  • Much slower than Sublime Text and a bit slower than Visual Studio Code

  • (It looks rather dull to me, but this is certainly opinion-based)

  • 1
    Atom actually has lots of troubles highlighting long lines and other languages, like SQL, PHP and stuff. Other than that, solid answer! – Ismael Miguel Jul 2 '18 at 21:50
  • I tried Atom but I couldn't get it to open files in the same instance (in a new tab): when I double clicked on a file, they always opened a new Atom window, which isn't how I like to work. It's part of our web designers' workflow (eg for making concatenated css files from scss) so I would like to get back into it. I think I need to have another go and try to crack the tabs v windows thing. – Max Williams Jul 3 '18 at 8:02
8

Kate

Pros:

  • Cross-platform (Linux, Mac OS, Windows)
  • Open source
  • Free software (GPL)
  • Fast
  • Has syntax highlighting support for a lot of different files (Markup, Scripts, Source code, configuration, ...)
  • Comes with plugins like a terminal or file browser, custom ones also supported
  • Highly customizable
  • Has vi mode
  • It's not an electron application (small size (AppImage is ~50MB), low memory usage)

Kate

Cons:

  • KDE application, so you need to pull in some of KDE and Qt's stuff if you're not using any of that
  • 2
    Used to use Kate/Kwrite but icons started disappearing when running in a non-KDE desktop env even with all KDE libs installed. – ivanivan Jul 2 '18 at 15:27
  • 1
    @ivanivan icons disappearing in Kate or in unrelated apps? – Ruslan Jul 3 '18 at 11:38
  • @Ruslan - in Kate. Important things, like the Save button.... – ivanivan Jul 3 '18 at 12:33
  • @ivanivan you might want to try installing Oxygen or KFaenza icons (or whatever official icons are default in modern KDE): KDE seems to have some differences in naming or placement of some icons. I remember oxygen-gtk style to have quite some logic for mapping KDE icons to GTK ones to achieve consistent look. – Ruslan Jul 3 '18 at 12:44
  • @Ruslan - I did a full install of KDE - icon missing, unless actually running KDE desktop (I prefer MATE). No longer an issue - didn't feel like using hundreds of megs of storage for libs, etc. for a single application. Very happy wtih Geany as a replacement, happier even than Kate made me – ivanivan Jul 3 '18 at 13:43
7

Emacs

Pros:

  • Cross platform
  • Free and Open Source Software
  • Free of charge
  • Supports both GUI and CLI usage, even for a single instance simultaneously. You can have your emacs windows in your desktop; login remotely through ssh and view the same files and changes through the CLI .
  • May have multiple windows (like X11 windows) for the same instance. This is great if you're using a tiling window manager.
  • Has syntax highlighting
  • Easy to extend on the fly, via Emacs Lisp
  • Has plenty of packages for many things like modifying your code while it's running (not just lisp, but also javascript in a browser, etc.), or being your email client.

enter image description here

Cons:

  • vim has way better keybindings. There's the package evil to have vim keybindings in emacs, but it interferes with other emacs usage.
  • vim makes it easier to interact with other commands of the OS through :r !, :w !, and :%!
  • vim macros beat emacs macros any day
  • emacs has the idea of "major modes" which are tied to filetypes and define keybindings and variables to control emacs behaviour. The idea is that each filetype might have a different ideal in how to work with it. This unfortunately means a less consistent use of emacs across filetypes. Some major modes I've downloaded are great, and for their languages, I use emacs. However, for other languages, vim is my choice.
  • 2
    Still has trouble booting from bare metal :) – ivanivan Jul 3 '18 at 1:09
  • 1
    If I see correctly, then on the image there is visible, it does NOT recognize variables inside strings as per my requirement! – LinuxSecurityFreak Jul 3 '18 at 2:04
  • What do you mean "better keybindings", is there something wrong with Escape Meta Alt Control Shift – pipe Jul 3 '18 at 12:29
  • 1
    Wow, you alternate between emacs and vim for different files? Respect. I've used each one extensively, but I can only handle one set of editing keystrokes at a time... – alexis Jul 3 '18 at 12:56
6

Geany

Cross platform. GPL licensed. Syntax high lighting. Actually a very light weight IDE - has buttons for "compile" "build" and such that can have specific actions set for appropriate file types/extensions.

Cons:

  • Does not recognize variables inside strings.

Geany Ubuntu bash

2

jEdit

Written in Java, and runs on just about any platform which supports Java. Free for the downloading at http://www.jedit.org/index.php?page=download. Syntax highlighting for shell scripts works great - I use it daily at work. Has many, many plugins to allow you to customize it for your situation.

jEdit screenshot

I am not a contributor to this project, just a happy user.

1

CudaText with plugin "Hilite Vars".

Pros:

  • Cross platform (Linux, Mac, Windows)
  • Open Source
  • Free of charge
  • Speed is almost like Sublime has
  • Syntax highlighting for Bash, with plugin "Hilite Vars" (in Addon Manager) it highlights variables in strings

CudaText screenshot

0

NetBeans
VScode setup and use is a bit large and unwieldy for my tastes, my dev work is pretty light though so it isn't worth my time to really get to know several IDEs. I like Kwrite too. For me NetBeans for multi-file and compiled projects(C++) and Kwrite for quick single page scripts. (I use console VIM as well, mainly because I do a lot of ssh type admin work, gVIM just seems awkward to me.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.