让 Eclipse 默认在文本编辑器中打开 .html?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11831153/
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
Getting Eclipse to open .html in text-editor by default?
提问by user1438003
Eclipse Juno keeps opening my HTML files in a embedded web-browser, rather than in an embedded syntax-highlighting editor.
Eclipse Juno 不断在嵌入式 Web 浏览器中打开我的 HTML 文件,而不是在嵌入式语法高亮编辑器中。
I have installed:
我已经安装:
- Web Page Editor
- Eclipse Web Developer Tools
- PyDev for Eclipse
- 网页编辑器
- Eclipse Web 开发人员工具
- 用于 Eclipse 的 PyDev
Specifically see the screenshotof my install applications.
具体看我安装应用的截图。
I need it to work with Django templates + any other Python templates with HTML + normal HTML+JS files.
我需要它与 Django 模板 + 任何其他带有 HTML + 普通 HTML+JS 文件的 Python 模板一起使用。
How do I find this editor, and select it as default?
我如何找到这个编辑器,并选择它作为默认?
采纳答案by user1438003
Nothing worked and I had begun getting an unrelated error on startup with a troubleshooting step requiring reinstall.
没有任何效果,我开始在启动时遇到不相关的错误,并且需要重新安装故障排除步骤。
This time I downloaded Eclipse for Mobile Developers, and since then I have added my other packages and it's all working fine =).
这次我下载了Eclipse for Mobile Developers,从那时起我添加了我的其他包,并且一切正常 =)。
None of the editors work the way I want them to though, however I have ended up with Django-Editor(which is slightly better than Aptana's one).
虽然没有一个编辑器按照我希望的方式工作,但是我最终使用了Django-Editor(比 Aptana 的稍好一些)。
回答by Gilbert Le Blanc
Select Window -> Preferences from the main Eclipse menu.
从 Eclipse 主菜单中选择 Window -> Preferences。
Select General -> Editors -> File Associations from the Preferences menu.
从首选项菜单中选择常规 -> 编辑器 -> 文件关联。
For .htm and .html, left click on the extension in the upper view. Left click on the Add button to the right of the lower view to add one or more HTML editors. Left click on your favorite HTML editor and left click on the Default button to make it the default editor.
对于 .htm 和 .html,左键单击上方视图中的扩展名。左键单击下方视图右侧的添加按钮以添加一个或多个 HTML 编辑器。左键单击您最喜欢的 HTML 编辑器,然后左键单击“默认”按钮以使其成为默认编辑器。
If the extension you want is missing, left click on the Add button to the right of the upper view to add the extension.
如果缺少所需的扩展名,请左键单击上方视图右侧的添加按钮以添加扩展名。
回答by CgodLEY
If you want to add an HTML editor to Eclipse:
如果要向Eclipse 添加 HTML 编辑器:
- Go to Help -> Install New Software
- Choose the site
http://download.eclipse.org/releases/your_eclipse_version
- Type the filter text
Web Page Editor
- There should be one result. Check off the box and press the Finish button.
- 转到帮助 -> 安装新软件
- 选择站点
http://download.eclipse.org/releases/your_eclipse_version
- 输入过滤器文本
Web Page Editor
- 应该只有一个结果。选中该框并按“完成”按钮。
Now you should have the option to choose the HTML editor when opening files by right-clicking, Open With -> HTML Editor.
现在,您应该可以在打开文件时通过右键单击“打开方式”->“HTML 编辑器”来选择 HTML 编辑器。
If you want to always use the HTML editorto open HTML files then go to the Eclipse preferences -> General -> Editors -> File Associations. Select the extension up top (e.g. *.htm, *.html) then select the HTML editor in the bottom pane and press the Default
button.
如果您想始终使用 HTML 编辑器打开 HTML 文件,请转到 Eclipse 首选项 -> 常规 -> 编辑器 -> 文件关联。选择顶部的扩展名(例如 *.htm、*.html),然后在底部窗格中选择 HTML 编辑器并按下Default
按钮。
回答by gabocles
I had a similar problem. Once I installed the html editor (thanks to CgodLEY), still my html files wouldnt show up with that editor. Solution? Right clickon the html/htm file, go to "open with" and select "HTML editor". Fortunately that solve everything...
我有一个类似的问题。一旦我安装了 html 编辑器(感谢 CgodLEY),我的 html 文件仍然不会显示在该编辑器中。解决方案?右键单击html/htm 文件,转到“打开方式”并选择“ HTML 编辑器”。幸运的是,解决了一切......
回答by Brian Fernandes
For those still finding their way here, yes, do add an HTML editor to Eclipse as CgodLEY suggests, if you're having this problem. However, even if you already have an HTML editor in your Eclipse installation, consider installing CodeMixfor a superlative HTML editing experience - take a look at the differences here.
对于那些仍然在这里找到方法的人,是的,如果您遇到此问题,请按照 CgodLEY 的建议向 Eclipse 添加一个 HTML 编辑器。但是,即使您的 Eclipse 安装中已经有一个 HTML 编辑器,也可以考虑安装CodeMix以获得最高级的 HTML 编辑体验 - 在此处查看差异。
回答by BobHy
Now, there's a Django-aware template editor available for free:
现在,有一个免费的 Django 感知模板编辑器:
I installed it in Eclipse Kepler / Django 1.6, it's working fine for me.
我将它安装在 Eclipse Kepler/Django 1.6 中,它对我来说很好用。
Note: if you previously opened a specific .HTML file with some other editor, you need to go back to the project view, right click on the .HTML file, select 'open with...' and explicitly select Django editor.
注意:如果您之前使用其他编辑器打开了特定的 .HTML 文件,您需要返回项目视图,右键单击 .HTML 文件,选择“打开方式...”并明确选择 Django 编辑器。
回答by patrick
To answer the opening of your question: Note that Eclipse will use the built-in web-browser to view html files if you are opening them outside of a project, as in "File->Open File ...", when that file isn't part of a project.
要回答您的问题:请注意,如果您在项目之外打开 html 文件,Eclipse 将使用内置的网络浏览器查看 html 文件,如“文件->打开文件...”,当该文件不是项目的一部分。
I just created a dummy project, and now the html files are correctly opened with the editor selected in my preferences. Success!
我刚刚创建了一个虚拟项目,现在可以使用我的首选项中选择的编辑器正确打开 html 文件。成功!