2009-08-31 53 views
170

Eclipse有沒有什麼像樣的bash插件?我唯一的要求是語法高亮。我已經搜索了一下,但沒有看到任何看起來像「the」bash插件的東西。Eclipse的Bash腳本插件?

+0

什麼是您的操作系統?你是否試圖在Windows上運行這個shell模擬器?有點像Cygwin – amphibient

+0

另請參閱:http://stackoverflow.com/questions/5324471/problem-installing-shelled-plugin-in-eclipse-helios –

回答

137

ShellEd看起來很有希望,做語法高亮顯示,並具有積極的評價,雖然我還沒有嘗試過自己。 Redhat的發行版包含approved。 Eclipse網站上的ShellEd plugin page有更多信息,而他們的wiki上有installation instructions

需要注意的是,如果你不運行Eclipse的了最新版本(撰寫本文時,朱諾),你需要使用一箇舊版本,例如2.0.1與靛藍兼容。

+1

我使用這個插件,它是非常有用的。 – romaintaz

+0

@romaintaz你是如何安裝它的?你可以請看看http://stackoverflow.com/questions/5064250/question-on-installing-eclipse-plugin – London

+0

這個插件是偉大的!一個問題:有誰知道如何獲得語法高亮來支持bash的HEREDOC語法? 例如: 貓> /tmp/somefile.out <<「EOF」 這段文本應該加亮後AS一HEREDOC 此$變量和報價不可在加亮後,因爲我們使用一個帶引號的「EOF」 EOF – TrinitronX

36

編輯(2013年8月3日):使用http://sourceforge.net/projects/shelled/files/shelled/update/爲最新版本

編輯(2013年2月25日):非必要基於Eclipse 4.2炮轟2.0.2安裝Linux的工具。 1。另外,不需要下載zip文件。這裏的炮轟2.0.2的更新站點:http://sourceforge.net/projects/shelled/files/shelled/ShellEd%202.0.2/update/

舊文章:

我喜歡帶殼爲好。如果您現在安裝它,則需要下載zip文件並在Eclipse的安裝新軟件嚮導中指向它。您還需要從

http://download.eclipse.org/technology/linuxtools/update 
+0

直接鏈接到zip文件:http://ppl.ug/tvjARs_cKQE/dl –

+0

炮轟網站:http://sourceforge.net/projects/shelled/ –

+0

+1這是今天最有價值的信息。我希望在使用Juno SR2之前一小時之前安裝好了... –

11

安裝手冊插件只要按照從ShellEd's InstallGuide

+0

沒有爲我工作:放在更新網站,它發現只有炮擊,它立即拒絕安裝,因爲它想要一個用戶界面模塊。 – Rob

+3

正如其文檔中所述(http://sourceforge.net/apps/trac/shelled/wiki/Documentation/InstallGuide),您必須將此http://download.eclipse.org/technology/linuxtools/update添加到可用的軟件站點。之後,事情應該工作得很好! – pedromanoel

+0

2014年7月:shelled不再可通過linuxtools URL/repo for eclipse獲得。 – woohoo

13

調試器的Bash 3版官方說明(伯恩再次殼)。
Eclipse插件。只能使用shell腳本編輯器ShellEd。 basheclipse

7

自由EclipseColorer Editor可以做語法高亮顯示的bash腳本。

但是,它不使用Eclipse的「大綱視圖」,即它不與的功能定義列表填充它。 語法突出顯示有時會停在腳本的中間。然後重新打開腳本會有所幫助。

+1

我使用了ShellEd一段時間,但它陷入了大文件,我發現它的autoindent選擇令人沮喪。 EclipseColorer編輯器適合我的目的。擁有這個插件的其他文件類型的大列表也很好。 – Demyn

+1

我也使用了ShellEd兩年,但它不斷弄亂縮進,有一個非常煩人的習慣,最初摺疊所有評論(不可配置),並且非常緩慢。剛切換到EclipseColorer,似乎工作正常。 –

0

我試過炮轟,但也不會承認我的任何shell腳本,甚至當我重新啓動蝕。我添加了ksh解釋器並將其設置爲默認值,但它沒有任何差別。

最後,我關閉了,這是開放的,顯示KSH文件選項卡,然後重新打開它。這使它正常工作。使用一段時間後,我也可以推薦它。

4

炮轟之下如何安裝炮轟

解決方案不爲我工作。很多依賴關係的錯誤。找到適合我的解決方案。

系統:

Linux的Lubuntu 12。04

IDE:

Eclipse的開普勒

在Eclipse中,進入幫助>安裝新軟件

單擊Add ...

添加下面的位置,http://download.eclipse.org/releases/kepler,並命名爲「Eclipse開普勒」。

單擊確定。

選擇新創建的Eclipse Kepler站點。

展開底部的Web,XML,Java EE和OSGi企業開發部分。 選擇WST服務器適配器。

點擊下一步,並像往常一樣安裝。

重啓Eclipse

然後同樣添加炮轟回購上面列出: http://sourceforge.net/projects/shelled/files/shelled/update/

並安裝它。

重新啓動Eclipse。

在Eclipse靛藍還擔任過這裏說: http://docs.wraithmonster.com/install-shelled

享受:)

+0

不知道爲什麼,但是這樣也解決了我之後以及之前安裝2次不成功的問題;我在Mac OS X上的Eclipse Kepler上 –

2

我會在這裏重現一個很好的教程,因爲我失去了這篇文章,需要一些時間來重新找到它!

添加語法高亮新的語言與Colorer庫的Eclipse

假設你有一個包含一些編程語言的語法和詞法結構Eclipse不支持(例如d/iptables的或任何一個HRC文件其他腳本語言)。

使用EclipseColorer插件,您可以輕鬆地爲其添加支持。

去幫助 - >安裝新軟件,然後單擊添加.. 在名稱字段寫入Colorer並在位置字段寫入http://colorer.sf.net/eclipsecolorer/

選擇你剛剛與工作添加的條目:組合框,等待組件列表來填充,然後點擊全選

點擊下一步,然後按照說明

一旦安裝了該插件後,關閉Eclipse。

您的HRC文件複製到 [EclipseFolder] \插件\ net.sf.colorer_0.9.9 \ colorer \ HRC \汽車\類型

[EclipseFolder] = /家庭/名爲myUsername /。日食

使用您喜歡的文本編輯器打開

[EclipseFolder] \插件\ net.sf.colorer_0.9.9 \ colorer \ HRC \汽車\ empty.hrc

添加相應的原型元。例如,如果您的HRC文件d.hrc,empty.hrc看起來就像這樣:

<?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> 

保存更改並關閉文本編輯器

打開Eclipse和去窗口 - >首選項 - >常規 - >編輯 - >文件關聯

在文件類型部分,單擊Add ...,並在相應的文件類型填寫(例如.D)

單擊確定,然後單擊列表中的

新添加的條目

在關聯的編輯器部分中,單擊添加..,選擇着色器編輯器並按確定。

好的,難的部分是您必須瞭解HCR語法。

你可以看看在

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

學習如何做到這一點,並探索其他許多HCR的文件。在這一刻,我沒有找到任何文件。

我的禮物是一個基本的和不完整的iptables語法突出顯示。如果你改善,請與我分享。

<?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> 

在這之後,你必須將文件保存爲iptables.hcr並添加罐內:

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

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

+0

我通過添加通常的Eclipse「幫助/安裝/添加站點」路徑(eclipse站點:http://colorer.sf.net/eclipsecolorer/)來安裝EclipseColorer,它是無痛的。然後我重新啓動了,Colorer很快地向我展示了我想用語法突出的漂亮的bash腳本。對於那些只想爲腳本添加顏色的人來說,這看起來不像我在博客和評論中看到的那樣安裝ShellEd,但我只是嘗試了這一點,而不是兩者。 –

2

ShellEd是Eclipse的一個很好的插件。

此鏈接幫助我進行安裝:http://mattnorris.me/blog/install-eclipse-shelled-plugin/

步驟:

  1. 下載炮轟:http://sourceforge.net/projects/shelled/files/latest/download - 該文件名爲類似net.sourceforge.shelled現場-2.0壓縮文檔。 x.zip。

  2. 然後單擊幫助>安裝新軟件...

  3. 單擊Add ...在右上角。
  4. 單擊歸檔...
  5. 導航到保存壓縮歸檔文件net.sourceforge.shelled-site-2.0.x.zip的位置並將其選中。
  6. 單擊確定。 (不要擔心可選的Name字段,Eclipse會自動命名它。)
  7. 選擇新的Shell腳本複選框。
  8. 單擊下一步。
  9. 再次點擊下一步。
  10. 選擇「我接受許可協議的條款」。
  11. 單擊完成。
  12. 重新啓動Eclipse。
0

它適用於我在氧氣。

1)轉到幫助> Eclipse Marketplace ...並搜索「DLTK」。你會發現像「Shell腳本(DLTK)5.8.0」。安裝它並重新啓動Eclipse。

(或拖放從這個網頁 「Install」 按鈕到Eclipse:https://marketplace.eclipse.org/content/shell-script-dltk)在項目資源管理器外殼/批處理文件

Shell Script (DLTK)

2)右擊>打開方式>其他...並選擇Shell腳本編輯器。您還可以將編輯器與該擴展的所有文件關聯。

Shell script editor

+0

回購不再有效。糾正它。 –

1

現在存在着插件叫做 「擊編輯器」 專用bash腳本。 它可以在Eclipse的市場:

Bash editor log

您可以在https://marketplace.eclipse.org/content/bash-editor或市場客戶端找到它的「慶典」搜索時。

該插件目前標記爲BETA,但是穩定。

+0

該插件不再是BETA,但標記爲生產/穩定 – hexadez

+0

死鏈接。更改。 –

+0

不,它不是一個死鏈接:我剛剛打開https://marketplace.eclipse.org/content/bash-editor並且它完全響應。也許你有代理或網絡問題? – hexadez