Textmate 中的 Java 代码格式化
有没有一种方法/捆绑/快捷方式可以在 TextMate 中格式化 Java 源代码? (正如我们在 Eclipse 中使用 Shift+Command+F 所做的那样)。
Is there a way/bundle/shortcut to format the Java Source in TextMate?
(As we do with Shift+Command+F in Eclipse).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它必须
也是文本>缩进选择
It must be
which is also Text>Indent Selection
Ctrl+Q
虽然它可能不是您所期望的:(
alt text http://img27 .imageshack.us/img27/97/capturadepantalla200910w.png
Ctrl+Q
Although It may not be what you expect :(
alt text http://img27.imageshack.us/img27/97/capturadepantalla200910w.png
警告:读到最后,我意识到格式是它所没有的功能。我目前使用的是这个过程,然后alt+tab到Eclipse进行格式化。 TextMate 和 Eclipse 似乎都没有并发编辑同一个文件的问题,而且工作得很好。然而我意识到这不是最初的问题。
我使用 eclim 和 eclim TextMate 包。我不会撒谎,您必须运行 Eclipse 才能使用它。不过,您可以禁用 GUI 并将 Eclipse 作为无头守护程序运行,或者只是最小化 Eclipse,以防以后需要它。这是一个很好的折衷方案,并且因其为 TextMate 提供的功能而非常值得。
这给了我:
这些功能中的每一个都提供与 Eclipse 本身相同的功能。
目前该捆绑包仅支持 Java,但 eclim 本身(最初是为 vim 编写的 Eclipse 插件)支持更多功能和语言,并且正在等待合适的人来为所有内容实现 Eclipse 功能。
您可以在这里找到 eclim:
http://eclim.org/
eclim 包位于 GetBundles 中。
如果您没有 GetBundles,我推荐它。它是一个捆绑包,允许您轻松地从多个存储库下载新捆绑包,所有这些都在 TextMate 内进行。
在终端中运行以下命令来安装它:
cd ~/Library/Application\ Support/TextMate/Bundles
svn co <a href="http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/" rel="nofollow">http://svn.textmate.org/trunk/Review/Bundles/ GetBundles.tmbundle/
如果您不想安装它,eclim textmate 包位于此处:
https://github.com/JulianEberius/Eclim.tmbundle
运行 eclim 安装程序时,选择包含“插件”的 Eclipse 文件夹。然后,当您启动 Eclipse 时,转到 Window->Show View->Other。从“eclim”中选择“eclim”。 TextMate 包需要运行此视图才能检测 eclim 服务器。您应该在控制台窗口中看到一些信息,最后一行显示如下内容:Eclim Server Started on port 9091。如果是这样,它应该可以在 TextMate 中工作。
你知道吗,我只是去为你抓住键盘快捷键,然后意识到“格式”是我总是切换到 Eclipse 使用的那个。对此感到抱歉。但是,嘿,eclim 无论如何都很棒,也许当我有时间时我会为 TextMate 编写格式命令。源代码是用 Python 编写的,看起来相对简单。
Warning: I got to the end and realized format was the one feature this DOESN'T have. I currently use this process, and then alt+tab to Eclipse to format. Neither TextMate nor Eclipse seem to have a problem with concurrently editing the same file and it works beautifully. However I realize this wasn't the original question.
I use eclim and the eclim TextMate bundle. I'm not gonna lie, you do have to run Eclipse to use it. However you can disable the GUI and run Eclipse as a headless daemon or just minimize Eclipse in case you need it for something later. It's a good compromise and well worth it for the features it provides to TextMate.
This gives me :
Each of these features provides the same functionality as Eclipse itself.
Currently the bundle only supports Java, but eclim itself (which is an Eclipse plugin originally written for vim) supports many more features and languages, and is just waiting for the right person to come along and implement Eclipse features for everything.
You can find eclim here:
http://eclim.org/
And the eclim bundle is in GetBundles.
If you don't have GetBundles, I recommend it. It's a bundle that allows you easily download new bundles from several repositories, all from within TextMate.
run these commands in terminal to install it:
cd ~/Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
If you prefer not to install it, the eclim textmate bundle is here:
https://github.com/JulianEberius/Eclim.tmbundle
When you run the eclim setup, choose the Eclipse folder that contains 'plugins'. Then, when you launch Eclipse, go to Window->Show View->Other. Choose 'eclim' from 'eclim'. This view needs to be running for the TextMate bundle to detect the eclim server. You should see some information go through the console window, with the last line saying something like: Eclim Server Started on port 9091. If so, it should work in TextMate.
You know what, I just went to grab the keyboard shortcut for you, and realized 'format' is the one I always switch to Eclipse to use. Sorry bout that. But hey, eclim is fantastic anyway and maybe when I have some time I'll write the format command for TextMate. The source is in Python and looks relatively straightforward.
可能你想要的是这
适用于任何语言
Probably what you want is this
Works for any language