175

Are there any decent bash plug-ins for Eclipse? My only requirement is syntax highlighting. I've googled about but did not see anything that looked like "the" bash plug-in.

Stu Thompson
  • 38,370
  • 19
  • 110
  • 156

11 Answers11

140

ShellEd looks promising, does syntax highlighting, and has positive reviews, although I've not tried it myself. It was approved for distro inclusion by Redhat. There's a little more info on the ShellEd plugin page on the Eclipse site, and installation instructions on their wiki.

Note that if you're not running an up-to-date version of Eclipse (as of this writing, Juno) you'll need to use an older version, for instance 2.0.1 is compatible with Indigo.

dimo414
  • 47,227
  • 18
  • 148
  • 244
ire_and_curses
  • 68,372
  • 23
  • 116
  • 141
  • 1
    I am using this plugin, and it is quite usefull. – Romain Linsolas Aug 31 '09 at 11:00
  • @romaintaz How did you install it? Can you please take a look at http://stackoverflow.com/questions/5064250/question-on-installing-eclipse-plugin – London Feb 21 '11 at 10:00
  • This plugin is great! One question: does anyone know how to get the syntax highlighting to support bash's HEREDOC syntax? For example: cat>/tmp/somefile.out<<'EOF' THIS TEXT SHOULD BE HILIGHTED AS A HEREDOC THIS $VARIABLE AND QUOTES SHOULD NOT BE HILIGHTED, BECAUSE WE'RE USING A QUOTED 'EOF' EOF – TrinitronX Apr 29 '11 at 20:11
  • that "ShellEd plugin page" link is broken. No doco anywhere on the sourceforge site. What's the point of a plugin that's hard to install? – Steve Bennett Jan 05 '12 at 01:56
  • 1
    @Steve Bennett - Not sure who the rant is directed at. Turns out links can change, after *2 years*. I've relinked it for you. And here are [some installation instructions for Eclipse Indigo](http://sourceforge.net/apps/trac/shelled/wiki/Documentation/InstallGuide). You're welcome. – ire_and_curses Jan 05 '12 at 02:27
  • Directed at this site http://shelled.sourceforge.net/ whose entire documentation seems to consist of the phrase "A superb shell editor for Eclipse." – Steve Bennett Jan 05 '12 at 07:46
  • 1
    ShellED is almost perfect. Almost, because it puts constraints on shell files, e.g. it doesn't allow you to create them within some non-generic projects (tested on EPIC and StatET). – Federico Giorgi Apr 03 '12 at 15:40
  • Switch to the Yoxos market place and you'll find it there – Peter Kahn May 29 '12 at 21:35
  • 5
    Correct me if I'm wrong. Currently, ShellEd doesn't seem to support audo-word-completion, refactoring, or debugging, making it almost the same as any text editor that has syntax highlighting and snippets support.. – kakyo Jan 29 '13 at 14:28
  • To install: http://stackoverflow.com/questions/5324471/problem-installing-shelled-plugin-in-eclipse-helios – The Student Jul 16 '13 at 13:29
  • ShellEd is awesome, but the first time I open a `*.sh` file it takes a really long time! – Jess Oct 02 '13 at 19:35
  • 3
    It does not work with Eclipse 4. Does anyone know any other plugin? – Pratik Khadloya Mar 18 '14 at 23:27
  • 7
    ShellEd Works perfectly with Eclipse 4.5. To install, choose "Install new software..." from Eclipse Help menu and put this URL : http://sourceforge.net/projects/shelled/files/shelled/update/ – fred727 Sep 24 '15 at 12:09
  • Works with `Kepler 4.3`. _Install New Software ... Location_ is: `http://sourceforge.net/projects/shelled/files/shelled/update/` and make sure that `File>Right Click>Open With>Shell Script Editor` is selected for **shell** files. – Fredrick Gauss Mar 10 '16 at 09:02
  • 8
    Nowadays go to http://www.eclipse.org/dltk/install.php. Install via the eclipse standard update site within your eclipse (e. g. `http://download.eclipse.org/releases/neon/`) Then look for `Programming languages` and `Dynamic Languages Toolkit - ShellEd`. – Torsten Aug 05 '16 at 16:06
  • ShellEd and DLTK is no longer developed. The DLTK developers have moved onto https://github.com/eclipse/shellwax which works well – dan carter Jul 13 '20 at 06:03
  • @Torsten- you rock, have been looking for this since long time, this tweak is really helpful. I think, you should put this in answer instead of comments as not everyone will go to this depth. – Nitin Tripathi Nov 06 '20 at 13:24
36

EDIT (8/3/2013): Use http://sourceforge.net/projects/shelled/files/shelled/update/ for latest version

EDIT (2/25/2013): Non need to install linux tool for shelled 2.0.2 on Eclipse 4.2.1. Also, no need to download zip file. Here's the update site of shelled 2.0.2: http://sourceforge.net/projects/shelled/files/shelled/ShellEd%202.0.2/update/

OLD POST:

I like Shelled as well. If you install it now, you need to download the zip file and point to it in the install new software wizard in Eclipse. You'll also need to install the man plugin from

http://download.eclipse.org/technology/linuxtools/update
Community
  • 1
  • 1
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
13

Debugger for Bash version 3(Bourne again shell).
Plugin for Eclipse. Will only work with shell script editor ShellEd. basheclipse

Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
avkosinsky
  • 241
  • 4
  • 2
10

Just follow the official instructions from ShellEd's InstallGuide

user819893
  • 129
  • 1
  • 4
  • Didn't work for me: put in the update site, it found only shelled, which promptly refused to install because it wanted a ui module. – Rob Jun 03 '12 at 20:15
  • 3
    As it says in their docs (http://sourceforge.net/apps/trac/shelled/wiki/Documentation/InstallGuide), you must add this http://download.eclipse.org/technology/linuxtools/update to the Available Software Sites. After that, thing should work just fine! – pedromanoel Jun 06 '12 at 20:37
  • July 2014: shelled is no longer available through linuxtools URL/repo for eclipse. – scrat.squirrel Jul 23 '14 at 22:57
7

The free EclipseColorer Editor can do syntax highlighting for bash scripts.

However, It does not use Eclipse's "Outline view", i.e it does not fill it with a list of function definitions. Sometimes syntax highlighting just stops in the middle of the script. Then reopening the script helps.

knb
  • 9,138
  • 4
  • 58
  • 85
  • 1
    I used ShellEd for awhile, but it gets bogged down with large files and I found its autoindent choices to be frustrating. EclipseColorer Editor is working well for my purposes. It is also nice to have this plug-ins large list of other file types. – Demyn Nov 15 '13 at 18:59
  • 1
    I also used ShellEd for two years, but it keeps messing up indentation, has a very annoying habit of folding all comments initially (not configurable), and is very slow. Just switched to EclipseColorer, seems to work fine. – Tw Bert Jan 21 '15 at 02:19
6

There exists now a dedicated bash script plugin called "Bash editor". It's available at eclipse market place:

Bash editor log

You can find it at https://marketplace.eclipse.org/content/bash-editor or by marketplace client when searching for "bash".

The plugin does also provide a debugger. Inisde official Bash Editor YouTube playlist you can find some tutorials about usage etc.

PS: I am the author of the mentioned plugin.

de-jcup
  • 1,402
  • 12
  • 27
4

ShellEd

Solutions below how to install ShellEd don't work for me. A lot of error on dependencies. Found solution that works for me.

System:

Linux Lubuntu 12.04

IDE:

Eclipse Kepler

In Eclipse, go to Help > Install New Software

Click Add...

Add the following Location, http://download.eclipse.org/releases/kepler, and name it "Eclipse Kepler".

Click OK.

Select the newly-created Eclipse Kepler site.

Expand the Web, XML, Java EE and OSGi Enterprise Development section at the bottom. Select WST Server Adaptors.

Click Next, and install like usual.

Restart Eclipse

Then add ShellEd repo likewise as listed above: http://sourceforge.net/projects/shelled/files/shelled/update/

And install it.

Restart Eclipse.

Also worked in Eclipse Indigo as said here: http://docs.wraithmonster.com/install-shelled

Enjoy :)

user3439968
  • 3,418
  • 1
  • 18
  • 15
  • don't know why, but this solved the issue for me as well after 2 unsuccessful installs earlier; I'm on Eclipse Kepler on Mac OS X – Hans Z. Dec 18 '14 at 10:36
2

I will reproduce a good tutorial here, because I lost this article and take some time to find it again!

Adding syntax highlighting for new languages to Eclipse with the Colorer library

Say you have an HRC file containing the syntax and lexical structure of some programming language Eclipse does not support (for example D / Iptables or any other script language).

Using the EclipseColorer plugin, you can easily add support for it.

Go to Help -> Install New Software and click Add.. In the Name field write Colorer and in the Location field write http://colorer.sf.net/eclipsecolorer/

Select the entry you’ve just added in the work with: combo box, wait for the component list to populate and click Select All

Click Next and follow the instructions

Once the plugin is installed, close Eclipse.

Copy your HRC file to [EclipseFolder]\plugins\net.sf.colorer_0.9.9\colorer\hrc\auto\types

[EclipseFolder] = /home/myusername/.eclipse

Use your favorite text editor to open

[EclipseFolder]\plugins\net.sf.colorer_0.9.9\colorer\hrc\auto\empty.hrc

Add the appropriate prototype element. For example, if your HRC file is d.hrc, empty.hrc will look like this:

<?xml version="1.0" encoding='Windows-1251'?>
 <!DOCTYPE hrc PUBLIC
 "-//Cail Lomecb//DTD Colorer HRC take5//EN"
 "http://colorer.sf.net/2003/hrc.dtd"
 >
 <hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd"
 ><annotation><documentation>
 'auto' is a place for include
 to colorer your own HRCs
</documentation></annotation>
    <prototype name="d" group="main" description="D">
         <location link="types/d.hrc"/>
        <filename>/\.(d)$/i</filename>
 </prototype>
</hrc>

Save the changes and close the text editor

Open Eclipse and go to Window -> Preferences -> General -> Editors -> File Associations

In the file types section, click Add.. and fill in the appropriate filetype (for example .d)

Click OK and click your newly added entry in the list

In the associated editors section, click Add.., select Colorer Editor and press OK

ok, the hard part is you must learn about HCR syntax.

You can look in

[EclipseFolder]/net.sf.colorer_0.9.9/colorer/hrc/common.jar

to learn how do it and explore many other hcr's files. At this moment I didn't find any documentation.

My gift is a basic and incomplete iptables syntax highlight. If you improve please share with me.

<?xml version="1.0" encoding="Windows-1251"?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN" "http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
    <type name="iptables">
        <annotation>
            <develby> Mario Moura - moura.mario  gmail.com</develby>
            <documentation>Support iptables EQL language</documentation>
            <appinfo>
                  <prototype name="iptables" group="database" description="iptables">
                       <location link="iptables.hrc"/>
                       <filename>/\.epl$/i</filename>
                  </prototype>  
            </appinfo>
        </annotation>

        <region name="iptablesTable" parent="def:Keyword"/>
        <region name="iptablesChainFilter" parent="def:Symbol"/>
        <region name="iptablesChainNatMangle" parent="def:NumberDec"/>
        <region name="iptablesCustomDefaultChains" parent="def:Keyword"/>
        <region name="iptablesOptions" parent="def:String"/>
        <region name="iptablesParameters" parent="def:Operator"/>
        <region name="iptablesOtherOptions" parent="def:Comment"/>
        <region name="iptablesMatchExtensions" parent="def:ParameterStrong"/>
        <region name="iptablesTargetExtensions" parent="def:FunctionKeyword"/>
        <region name="pyComment" parent="def:Comment"/>
          <region name="pyOperator" parent="def:Operator"/>
          <region name="pyDelimiter" parent="def:Symbol"/>


        <scheme name="iptablesTable">
            <keywords ignorecase="no" region="iptablesTable">
                <word name="mangle"/>
                <word name="filter"/>
                <word name="nat"/>
                <word name="as"/>
                <word name="at"/>
                <word name="asc"/>
                <word name="avedev"/>
                <word name="avg"/>
                <word name="between"/>
                <word name="by"/>
            </keywords>
        </scheme>

        <scheme name="iptablesChainFilter">
            <keywords ignorecase="no" region="iptablesChainFilter">
                <word name="FORWARD"/>
                <word name="INPUT"/>
                <word name="OUTPUT"/>
            </keywords>
        </scheme>

        <scheme name="iptablesChainNatMangle">
            <keywords ignorecase="no" region="iptablesChainNatMangle">
                <word name="PREROUTING"/>
                <word name="POSTROUTING"/>
                <word name="OUTPUT"/>
            </keywords>
        </scheme>

        <scheme name="iptablesCustomDefaultChains">
            <keywords ignorecase="no" region="iptablesCustomDefaultChains">
                <word name="CHTTP"/>
                <word name="CHTTPS"/>
                <word name="CSSH"/>
                <word name="CDNS"/>
                <word name="CFTP"/>
                <word name="CGERAL"/>
                <word name="CICMP"/>
            </keywords>
        </scheme>


        <scheme name="iptablesOptions">
            <keywords ignorecase="no" region="iptablesOptions">
                <word name="-A"/>
                <word name="--append"/>
                <word name="-D"/>
                <word name="--delete"/>
                <word name="-I"/>
                <word name="--insert"/>
                <word name="-R"/>
                <word name="--replace"/>
                <word name="-L"/>
                <word name="--list"/>
                <word name="-F"/>
                <word name="--flush"/>
                <word name="-Z"/>
                <word name="--zero"/>
                <word name="-N"/>
                <word name="--new-chain"/>
                <word name="-X"/>
                <word name="--delete-chain"/>
                <word name="-P"/>
                <word name="--policy"/>
                <word name="-E"/>
                <word name="--rename-chain"/>
            </keywords>
        </scheme>

        <scheme name="iptablesParameters">
            <keywords ignorecase="no" region="iptablesParameters">
                <word name="-p"/>
                <word name="--protocol"/>
                <word name="-s"/>
                <word name="--source"/>
                <word name="-d"/>
                <word name="--destination"/>
                <word name="-j"/>
                <word name="--jump"/>
                <word name="-g"/>
                <word name="--goto"/>
                <word name="-i"/>
                <word name="--in-interface"/>
                <word name="-o"/>
                <word name="--out-interface"/>
                <word name="-f"/>
                <word name="--fragment"/>
                <word name="-c"/>
                <word name="--set-counters"/>
            </keywords>
        </scheme>

        <scheme name="iptablesOtherOptions">
            <keywords ignorecase="no" region="iptablesOtherOptions">
                <word name="-v"/>
                <word name="--verbose"/>
                <word name="-n"/>
                <word name="--numeric"/>
                <word name="-x"/>
                <word name="--exact"/>

                <word name="--line-numbers"/>
                <word name="--modprobe"/>
            </keywords>
        </scheme>

        <scheme name="iptablesMatchExtensions">
            <keywords ignorecase="no" region="iptablesMatchExtensions">
                <word name="account"/>
                <word name="addrtype"/>
                <word name="childlevel"/>
                <word name="comment"/>
                <word name="connbytes"/>
                <word name="connlimit"/>
                <word name="connmark"/>
                <word name="connrate"/>
                <word name="conntrack"/>
                <word name="dccp"/>
                <word name="dscp"/>
                <word name="dstlimit"/>
                <word name="ecn"/>
                <word name="esp"/>
                <word name="hashlimit"/>
                <word name="helper"/>
                <word name="icmp"/>
                <word name="ipv4options"/>
                <word name="length"/>
                <word name="limit"/>
                <word name="mac"/>
                <word name="mark"/>
                <word name="mport"/>
                <word name="multiport"/>
                <word name="nth"/>
                <word name="osf"/>
                <word name="owner"/>
                <word name="physdev"/>
                <word name="pkttype"/>
                <word name="policy"/>
                <word name="psd"/>
                <word name="quota"/>
                <word name="realm"/>
                <word name="recent"/>
                <word name="sctp"/>
                <word name="set"/>
                <word name="state"/>
                <word name="string"/>
                <word name="tcp"/>
                <word name="tcpmss"/>
                <word name="tos"/>
                <word name="u32"/>
                <word name="udp"/>                                                                              
            </keywords>
        </scheme>


    <scheme name="iptablesTargetExtensions">
            <keywords ignorecase="no" region="iptablesTargetExtensions">
                <word name="BALANCE"/>
                <word name="CLASSIFY"/>
                <word name="CLUSTERIP"/>
                <word name="CONNMARK"/>
                <word name="DNAT"/>
                <word name="DSCP"/>
                <word name="ECN"/>
                <word name="IPMARK"/>
                <word name="IPV4OPTSSTRIP"/>
                <word name="LOG"/>
                <word name="MARK"/>
                <word name="MASQUERADE"/>
                <word name="MIRROR"/>
                <word name="NETMAP"/>
                <word name="NFQUEUE"/>
                <word name="NOTRACK"/>
                <word name="REDIRECT"/>
                <word name="REJECT"/>
                <word name="SAME"/>
                <word name="SET"/>
                <word name="SNAT"/>
                <word name="TARPIT"/>
                <word name="TCPMSS"/>
                <word name="TOS"/>
                <word name="TRACE"/>
                <word name="TTL"/>
                <word name="ULOG"/>
                <word name="XOR"/>                                                                          
            </keywords>
        </scheme>



        <scheme name="iptables">
              <inherit scheme="iptablesTable"/>
              <inherit scheme="iptablesChainFilter"/>
              <inherit scheme="iptablesChainNatMangle"/>
              <inherit scheme="iptablesCustomDefaultChains"/>                                     
              <inherit scheme="iptablesOptions"/>
              <inherit scheme="iptablesParameters"/>
              <inherit scheme="iptablesOtherOptions"/>
              <inherit scheme="iptablesMatchExtensions"/>
              <inherit scheme="iptablesTargetExtensions"/>

   <!-- python operators : http://docs.python.org/ref/keywords.html -->
   <keywords region="pyOperator">
    <symb name="+"/>
    <symb name="-"/>
    <symb name="*"/>
    <symb name="**"/>
    <symb name="/"/>
    <symb name="//"/>
    <symb name="%"/>
    <symb name="&lt;&lt;"/>
    <symb name=">>"/>
    <symb name="&amp;"/>
    <symb name="|"/>
    <symb name="^"/>
    <symb name="~"/>
    <symb name="&lt;"/>
    <symb name=">"/>
    <symb name="&lt;="/>
    <symb name=">="/>
    <symb name="=="/>
    <symb name="!="/>
    <symb name="&lt;>"/>
   </keywords>


   <!-- basic python comment - consider it everything after # till the end of line -->
   <block start="/#/" end="/$/" region="pyComment" scheme="def:Comment"/>

   <block start="/(u|U)?(r|R)?(&quot;{3}|&apos;{3})/" end="/\y3/"
      region00="def:PairStart" region10="def:PairEnd"
      scheme="def:Comment" region="pyComment" />
      <!-- TODO: better scheme for multiline comments/docstrings -->
      <!-- scheme="StringCommon" region="pyString" /> -->


   <!-- python delimiters : http://docs.python.org/ref/delimiters.html -->
   <keywords region="pyDelimiter">
    <symb name="+"/>
    <symb name="("/>
    <symb name=")"/>
    <symb name="["/>
    <symb name="]"/>
    <symb name="{"/>
    <symb name="}"/>
    <symb name="@"/>
    <symb name=","/>
    <symb name=":"/>
    <symb name="."/>
    <symb name="`"/>
    <symb name="="/>
    <symb name=";"/>
    <symb name="+="/>
    <symb name="-="/>
    <symb name="*="/>
    <symb name="/="/>
    <symb name="//="/>
    <symb name="%="/>
    <symb name="&amp;="/>
    <symb name="|="/>
    <symb name="^="/>
    <symb name=">>="/>
    <symb name="&lt;&lt;="/>
    <symb name="**="/>
   </keywords>



        </scheme>
    </type>

After this you must save the file as iptables.hcr and add inside the jar:

[EclipseFolder]/net.sf.colorer_0.9.9/colorer/hrc/common.jar

Based in: https://ohadsc.wordpress.com/2012/05/26/adding-syntax-highlighting-for-new-languages-to-eclipse-with-the-colorer-library/

macm
  • 1,959
  • 23
  • 25
  • I installed EclipseColorer by adding via the usual Eclipse "Help / Install / Add Site" route (eclipse site: http://colorer.sf.net/eclipsecolorer/) and it was painless. Then I restarted and Colorer very quickly showed me the bash scripts I wanted to work with in syntax highlighted niceness. For one who just wants to add colors to scripts, this seems less convoluted than installing ShellEd from what I see in blogs and comments, but I only tried this, not both. – charles ross Feb 07 '17 at 16:30
1

ShellEd is a good plugin for Eclipse.

This link helped me to install it: http://mattnorris.me/blog/install-eclipse-shelled-plugin/

Steps:

  1. Download ShellEd: http://sourceforge.net/projects/shelled/files/latest/download - The file is a zipped archive named something like net.sourceforge.shelled-site-2.0.x.zip.

  2. Then click Help > Install New Software...

  3. Click Add... in the upper right.
  4. Click Archive...
  5. Navigate to where you saved the zipped archive net.sourceforge.shelled-site-2.0.x.zip and select it.
  6. Click OK. (Don't worry about the optional Name field. Eclipse will name it automatically.)
  7. Select the new Shell Script checkbox.
  8. Click Next.
  9. Click Next again.
  10. Select "I accept the terms of the license agreement."
  11. Click Finish.
  12. Restart Eclipse.
Steven
  • 3,526
  • 3
  • 18
  • 28
0

I tried ShellEd, but it wouldn't recognize any of my shell scripts, even when I restarted eclipse. I added the ksh interpreter and made it the default, but it made no diffence.

Finally, I closed the tab that was open and displaying a ksh file, then re-opened it. That made it work correctly. After having used it for a while, I can also recommend it.

ivanlan
  • 979
  • 6
  • 8
-1

It works for me in Oxygen.

1) Go to Help > Eclipse Marketplace... and search for "DLTK". You'll find something like "Shell Script (DLTK) 5.8.0". Install it and reboot Eclipse.

(Or drag'n'drop "Install" button from this web page to your Eclipse: https://marketplace.eclipse.org/content/shell-script-dltk)

Shell Script (DLTK)

2) Right-click on the shell/batch file in Project Explorer > Open With > Other... and select Shell Script Editor. You can also associate the editor with all files of that extension.

Shell script editor