netbeans 是否支持为 .sh (bash) 脚本着色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1636765/
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
Does netbeans support coloring for .sh (bash) scripts?
提问by ufk
I use netbeans 6.8 beta and when i load .sh (bash) file it's not colored at all. i can add a new file association for the .sh extension but it doesn't seem that there is a known associated mime type.
我使用 netbeans 6.8 beta,当我加载 .sh (bash) 文件时,它根本没有颜色。我可以为 .sh 扩展名添加一个新的文件关联,但似乎没有已知的关联 mime 类型。
回答by Rahul
I have not tried this myself but you can get shell script support in Netbeans if you install the C/C++ plugin.
我自己没有尝试过,但是如果您安装C/C++ 插件,您可以在 Netbeans 中获得 shell 脚本支持。
回答by AndrewD
old question, time for an update (tested for 8.0.2,8.1,8.2).
老问题,更新时间 (针对 8.0.2、8.1、8.2 进行测试)。
Here's what worked for me
这对我有用
- Install C/C++plugin. This will recognize .sh extensions as bash files
- Install nb-noext-mime-resolver(for 8.2 you'll find it as No Extension MIME Resolver) . This will add support for files with no extension by recognizing the shebang line
- Go to tools/options/editor/spellchecker and uncheck 'Script and make comments'.(not available after 8.2) This will get rid of the red squiggly lines that appear under 'usr' and other legitimate notations in the shebang line and elsewhere.
- 安装 C/C++插件。这会将 .sh 扩展名识别为 bash 文件
- 安装 nb-noext-mime-resolver(对于 8.2,您会发现它是 No Extension MIME Resolver)。这将通过识别 shebang 行来增加对没有扩展名的文件的支持
- 转到工具/选项/编辑器/拼写检查器并取消选中“脚本并发表评论”。(在 8.2 之后不可用)这将消除出现在 'usr' 下的红色波浪线以及 shebang 行和其他地方的其他合法符号。
You'll get full syntax highlighting as well as the ability to right click and select 'run' which will launch your script in the built in terminal. very nice.
您将获得完整的语法突出显示以及右键单击并选择“运行”的能力,这将在内置终端中启动您的脚本。非常好。
To get the context menu 'run' to work with your shell
让上下文菜单“运行”与您的外壳一起使用
- Select 'Run'/'Set Project Configuration'/'Customize'
- Click 'New' and add a name for your shell like 'bash' or 'cygwin'
- Select 'Run As' 'Script (run in command line'
- Where it says 'Php Interpreter' (or equivilent) add the path to your bash shell. e.g: C:\cygwin\bin\bash.exe
- Click 'ok'.
- 选择“运行”/“设置项目配置”/“自定义”
- 单击“新建”并为您的 shell 添加一个名称,例如“bash”或“cygwin”
- 选择“运行方式”“脚本(在命令行中运行”)
- 在它说“Php 解释器”(或等效)的地方将路径添加到您的 bash shell。例如:C:\cygwin\bin\bash.exe
- 单击“确定”。
Also, check out the properties of the bash files and you'll find some helpful ones.
此外,查看 bash 文件的属性,您会发现一些有用的。
回答by OliBlogger
This is very odd. I have NB6.8beta installed with the C/C++ plugin. When I open a .sh file I dosee syntax high lighting. Quotes strings show up in orange, commands are in blue.
这很奇怪。我安装了带有 C/C++ 插件的 NB6.8beta。当我打开一个 .sh 文件时,我确实看到了语法高亮。引号字符串以橙色显示,命令以蓝色显示。