score:140

Accepted answer

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.

score: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.

score:0

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

score: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.

score: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/

score: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 :)

score: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.

score: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.

score:10

just follow the official instructions from shelled's installguide

score:13

debugger for bash version 3(bourne again shell).
plugin for eclipse. will only work with shell script editor shelled. basheclipse

score: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

Related Query

More Query from same tag