Eclipse 的 Bash 脚本插件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1356827/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bash script plugin for Eclipse?
提问by Stu Thompson
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.
bash
Eclipse有没有像样的插件?我唯一的要求是语法高亮。我用谷歌搜索过,但没有看到任何看起来像“the”bash
插件的东西。
采纳答案by ire_and_curses
ShellEdlooks promising, does syntax highlighting, and has positive reviews, although I've not tried it myself. It was approvedfor distro inclusion by Redhat. There's a little more info on the ShellEd plugin pageon the Eclipse site, and installation instructionson their wiki.
ShellEd看起来很有前途,可以突出语法,并且得到了积极的评价,尽管我自己还没有尝试过。它被Redhat批准用于发行版。在 Eclipse 站点上的ShellEd 插件页面上有更多信息,在他们的 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.
请注意,如果您运行的不是最新版本的 Eclipse(在撰写本文时,Juno),您将需要使用旧版本,例如 2.0.1 与 Indigo 兼容。
回答by AlikElzin-kilaka
EDIT(8/3/2013): Use http://sourceforge.net/projects/shelled/files/shelled/update/for latest version
编辑(8/3/2013):使用http://sourceforge.net/projects/shelled/files/shelled/update/获取最新版本
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/
编辑(2/25/2013):无需在 Eclipse 4.2.1 上为 shelled 2.0.2 安装 linux 工具。此外,无需下载 zip 文件。这是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
我也喜欢壳牌。如果您现在安装它,您需要下载 zip 文件并在 Eclipse 的安装新软件向导中指向它。您还需要从以下位置安装 man 插件
http://download.eclipse.org/technology/linuxtools/update
回答by avkosinsky
Debugger for Bash version 3(Bourne again shell).
Plugin for Eclipse. Will only work with shell script editor ShellEd. basheclipse
Bash 版本 3 的调试器(Bourne 又是 shell)。
Eclipse 插件。仅适用于 shell 脚本编辑器 ShellEd。日食
回答by user819893
Just follow the official instructions from ShellEd's InstallGuide
只需按照ShellEd 的 InstallGuide的官方说明进行操作
回答by knb
The free EclipseColorer Editorcan do syntax highlighting for bash scripts.
免费的EclipseColorer Editor可以对 bash 脚本进行语法高亮显示。
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.
但是,它不使用 Eclipse 的“大纲视图”,即它不使用函数定义列表填充它。有时语法高亮只是在脚本中间停止。然后重新打开脚本会有所帮助。
回答by user3439968
ShellEd
壳牌
Solutions below how to install ShellEd don't work for me. A lot of error on dependencies. Found solution that works for me.
以下如何安装 ShellEd 的解决方案对我不起作用。关于依赖项的很多错误。找到适合我的解决方案。
System:
系统:
Linux Lubuntu 12.04
Linux Lubuntu 12.04
IDE:
IDE:
Eclipse Kepler
日食开普勒
In Eclipse, go to Help > Install New Software
在 Eclipse 中,转到帮助 > 安装新软件
Click Add...
点击添加...
Add the following Location, http://download.eclipse.org/releases/kepler, and name it "Eclipse Kepler".
添加以下位置http://download.eclipse.org/releases/kepler,并将其命名为“Eclipse Kepler”。
Click OK.
单击确定。
Select the newly-created Eclipse Kepler site.
选择新创建的 Eclipse Kepler 站点。
Expand the Web, XML, Java EE and OSGi Enterprise Development section at the bottom. Select WST Server Adaptors.
展开底部的 Web、XML、Java EE 和 OSGi Enterprise Development 部分。选择 WST 服务器适配器。
Click Next, and install like usual.
单击下一步,然后像往常一样安装。
Restart Eclipse
重启 Eclipse
Then add ShellEd repo likewise as listed above: http://sourceforge.net/projects/shelled/files/shelled/update/
然后像上面列出的那样添加 ShellEd 存储库:http: //sourceforge.net/projects/shelled/files/shelled/update/
And install it.
并安装它。
Restart Eclipse.
重新启动 Eclipse。
Also worked in Eclipse Indigo as said here: http://docs.wraithmonster.com/install-shelled
也在 Eclipse Indigo 中工作,如此处所述:http: //docs.wraithmonster.com/install-shelled
Enjoy :)
享受 :)
回答by hexadez
There exists now a dedicated bash script plugin called "Bash editor". It's available at eclipse market place:
现在存在一个称为“Bash 编辑器”的专用 bash 脚本插件。它可以在 eclipse 市场上买到:
You can find it at https://marketplace.eclipse.org/content/bash-editoror by marketplace client when searching for "bash".
在搜索“bash”时,您可以在https://marketplace.eclipse.org/content/bash-editor或通过市场客户端找到它。
The plugin does also provide a debugger. Inisde official Bash Editor
YouTube playlistyou can find some tutorials about usage etc.
该插件还提供了一个调试器。Inisde 官方Bash Editor
YouTube 播放列表你可以找到一些关于使用等的教程。
PS: I am the author of the mentioned plugin.
PS:我是上述插件的作者。
回答by macm
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
使用 Colorer 库为 Eclipse 添加新语言的语法突出显示
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).
假设您有一个 HRC 文件,其中包含 Eclipse 不支持的某些编程语言(例如 D/Iptables 或任何其他脚本语言)的语法和词法结构。
Using the EclipseColorer plugin, you can easily add support for it.
使用 EclipseColorer 插件,您可以轻松添加对它的支持。
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/
转到帮助 -> 安装新软件,然后单击添加.. 在名称字段中写入 Colorer,在位置字段中写入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.
安装插件后,关闭 Eclipse。
Copy your HRC file to [EclipseFolder]\plugins\net.sf.colorer_0.9.9\colorer\hrc\auto\types
将您的 HRC 文件复制到 [EclipseFolder]\plugins\net.sf.colorer_0.9.9\colorer\hrc\auto\types
[EclipseFolder] = /home/myusername/.eclipse
[EclipseFolder] = /home/myusername/.eclipse
Use your favorite text editor to open
使用您喜欢的文本编辑器打开
[EclipseFolder]\plugins\net.sf.colorer_0.9.9\colorer\hrc\auto\empty.hrc
[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:
添加适当的原型元素。例如,如果您的 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>
Save the changes and close the text editor
保存更改并关闭文本编辑器
Open Eclipse and go to Window -> Preferences -> General -> Editors -> File Associations
打开 Eclipse 并转到窗口 -> 首选项 -> 常规 -> 编辑器 -> 文件关联
In the file types section, click Add.. and fill in the appropriate filetype (for example .d)
在文件类型部分,单击添加.. 并填写适当的文件类型(例如 .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
在关联的编辑器部分,单击添加...,选择 Colorer Editor 并按 OK
ok, the hard part is you must learn about HCR syntax.
好的,困难的部分是您必须了解 HCR 语法。
You can look in
你可以进去看看
[EclipseFolder]/net.sf.colorer_0.9.9/colorer/hrc/common.jar
[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.
了解如何操作并探索许多其他 hcr 文件。此时我没有找到任何文档。
My gift is a basic and incomplete iptables syntax highlight. If you improve please share with me.
我的礼物是一个基本且不完整的 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="<<"/>
<symb name=">>"/>
<symb name="&"/>
<symb name="|"/>
<symb name="^"/>
<symb name="~"/>
<symb name="<"/>
<symb name=">"/>
<symb name="<="/>
<symb name=">="/>
<symb name="=="/>
<symb name="!="/>
<symb name="<>"/>
</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)?("{3}|'{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="&="/>
<symb name="|="/>
<symb name="^="/>
<symb name=">>="/>
<symb name="<<="/>
<symb name="**="/>
</keywords>
</scheme>
</type>
After this you must save the file as iptables.hcr and add inside the jar:
在此之后,您必须将文件保存为 iptables.hcr 并在 jar 中添加:
[EclipseFolder]/net.sf.colorer_0.9.9/colorer/hrc/common.jar
[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/
回答by Steven
ShellEd is a good plugin for Eclipse.
ShellEd 是一个很好的 Eclipse 插件。
This link helped me to install it: http://mattnorris.me/blog/install-eclipse-shelled-plugin/
此链接帮助我安装它:http: //mattnorris.me/blog/install-eclipse-shelled-plugin/
Steps:
脚步:
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.
Then click Help > Install New Software...
- Click Add... in the upper right.
- Click Archive...
- Navigate to where you saved the zipped archive net.sourceforge.shelled-site-2.0.x.zip and select it.
- Click OK. (Don't worry about the optional Name field. Eclipse will name it automatically.)
- Select the new Shell Script checkbox.
- Click Next.
- Click Next again.
- Select "I accept the terms of the license agreement."
- Click Finish.
- Restart Eclipse.
下载 ShellEd:http: //sourceforge.net/projects/shelled/files/latest/download- 该文件是一个名为 net.sourceforge.shelled-site-2.0.x.zip 的压缩档案。
然后单击帮助 > 安装新软件...
- 单击右上角的添加...。
- 单击存档...
- 导航到您保存压缩存档 net.sourceforge.shelled-site-2.0.x.zip 的位置并选择它。
- 单击确定。(不要担心可选的 Name 字段。Eclipse 会自动命名它。)
- 选中新的 Shell 脚本复选框。
- 点击下一步。
- 再次单击下一步。
- 选择“我接受许可协议的条款”。
- 单击完成。
- 重新启动 Eclipse。
回答by Alexander Ishmuradov
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.
1)转到帮助 > Eclipse Marketplace... 并搜索“DLTK”。您会找到类似“Shell Script (DLTK) 5.8.0”的内容。安装它并重新启动 Eclipse。
(Or drag'n'drop "Install" button from this web page to your Eclipse: https://marketplace.eclipse.org/content/shell-script-dltk)
(或者将“安装”按钮从此网页拖放到您的 Eclipse:https: //marketplace.eclipse.org/content/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.
2)在 Project Explorer 中右键单击 shell/batch 文件 > 打开方式 > 其他...并选择 Shell Script Editor。您还可以将编辑器与该扩展名的所有文件相关联。