Bash script plugin for Eclipse? [closed]
Asked Answered
B

11

176

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.

Bibbie answered 31/8, 2009 at 10:28 Comment(2)
what is your OS? are you trying to run this as a shell emulator on Windows? kind of like CygwinTeston
See also: #5324971Shred
C
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.

Ceraceous answered 31/8, 2009 at 10:38 Comment(17)
I am using this plugin, and it is quite usefull.Chapland
@romaintaz How did you install it? Can you please take a look at #5064750Springy
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' EOFMostly
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?Whomsoever
@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. You're welcome.Ceraceous
Directed at this site shelled.sourceforge.net whose entire documentation seems to consist of the phrase "A superb shell editor for Eclipse."Whomsoever
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).Corpulence
Switch to the Yoxos market place and you'll find it thereBathysphere
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..Qualitative
To install: #5324971Sullen
ShellEd is awesome, but the first time I open a *.sh file it takes a really long time!Damages
It does not work with Eclipse 4. Does anyone know any other plugin?Lamartine
ShellEd Works perfectly with Eclipse 4.5. To install, choose "Install new software..." from Eclipse Help menu and put this URL : sourceforge.net/projects/shelled/files/shelled/updateObjectivism
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.Gamekeeper
Nowadays go to 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.Wellappointed
ShellEd and DLTK is no longer developed. The DLTK developers have moved onto github.com/eclipse/shellwax which works wellPasha
@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.Aurelie
T
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
Theo answered 16/2, 2011 at 14:8 Comment(5)
Direct link to the zip file: ppl.ug/tvjARs_cKQE/dlTheo
Shelled site: sourceforge.net/projects/shelledTheo
+1 This is the most valuable piece of info for today. I wished I had it before I screwed my Juno SR2 install one hour ago...Vasileior
+1 for the exact ShellEd download URL. You can no longer download ShellEd in Eclipse Marketplace. ShellEd works very well.Reverential
ShellEd is available at the standard Eclipse Mars update site download.eclipse.org/releases/mars ... it is available under the entry Programming Languages -> Dynamic Languages Toolkit - ShellEd IDE.Hygiene
W
13

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

Worden answered 29/8, 2011 at 5:40 Comment(0)
C
10

Just follow the official instructions from ShellEd's InstallGuide

Cardioid answered 28/6, 2011 at 20:22 Comment(3)
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.Reconcile
As it says in their docs (sourceforge.net/apps/trac/shelled/wiki/Documentation/…), you must add this download.eclipse.org/technology/linuxtools/update to the Available Software Sites. After that, thing should work just fine!Aplanatic
July 2014: shelled is no longer available through linuxtools URL/repo for eclipse.Ainu
T
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.

Torrance answered 20/7, 2012 at 8:24 Comment(2)
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.Une
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.Pneumothorax
O
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.

Otiose answered 30/8, 2017 at 8:36 Comment(8)
The plugin is no longer BETA but marked as productive/stableOtiose
Dead link. Change it.Holst
No, its not a dead link: I just opened marketplace.eclipse.org/content/bash-editor and it does full respond. Maybe you got proxy or network problems?Otiose
Wow !! Its working now. Anyway, thanks. I wasn't behind firewall. Appreciate your turnaround.Holst
Thanks. Is there any way to toggle commenting for multiple lines? (as with the python editor)Squad
To toggle comments you have to press CTRL 7 inside editor. I created youtu.be/joKoMY6cpZY where you can see the usage in action.Otiose
It is not formatting the script.Latchstring
The plugin cannot format by its own, but it can use external formatting tools on save actions - please read github.com/de-jcup/eclipse-bash-editor/wiki/… -Otiose
K
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 :)

Kermitkermy answered 6/11, 2014 at 12:51 Comment(1)
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 XHohenzollern
D
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/

Dervish answered 20/1, 2015 at 12:37 Comment(1)
I installed EclipseColorer by adding via the usual Eclipse "Help / Install / Add Site" route (eclipse site: 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.Turboprop
W
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.
Windermere answered 1/7, 2016 at 15:32 Comment(0)
O
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.

Oballa answered 15/5, 2014 at 20:2 Comment(0)
P
-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

Precursor answered 24/8, 2017 at 21:40 Comment(1)
The repos are no longer valid. Correct it.Holst

© 2022 - 2024 — McMap. All rights reserved.