ITeye博客

RadRails终于有了比较完整的TextMate snippets

crazycode · 2006-11-15 06:28 · Rails · Markdown

今天在RadRails官网上看到一则消息http://www.radrails.org/blog/2006/11/13/dr-nic-cures-template-cancer: Dr Nic完成了TextMate snippets完整的radrails模板,马上按其网站上的说明安装到Radrails上:

  1. 下载两个模板XML文件(见附件压缩包中).
  2. 打开RadRails
  3. 依次打开 Windows > Preferences > Ruby > Editor > Templates, 可以看到已存在的模板(template)列表
  4. 点击选择任意一个模板(template),按Ctrl-A选择全部
  5. 点击Remove, 删除全部模板
  6. 点击Import…, 然后选择文件ruby-rr-templates.xml,完成ruby模板的导入
  7. 然后是rhtml,切换到Rails > Editiors > RHTML Editor > RHTML Templates
  8. 删除全部当前使用的模板(templates)
  9. 点击Import…, 选择文件rhtml-rr-templates.xml,完成rhtml模板的导入
  10. 点击确认(OK)按钮,使设置生效

使用方法上和标准的eclipse模板是一样的,比如输入habtm,按Alt+/,就会出现has_and_belongs_to_many :object,完整的清单可看一下textmate-snippets-cheat-sheethttp://pragmaticstudio.com/rails/RailsTextMateCheats.pdf。不过,花20分钟仔细看一下Radrails上的模板清单,会有更感性的认识。 试用了一下,比原来放出的那个2006-09-18.RADRails-TextMate_Templates-v1.xml完整多了,而且,Radrails0.8将内建这个template,看来TextMate的作者要有点压力了,嘿嘿。

评论(21)

  1. #21 楼 · dengchp · 2007-03-13 14:08

    我想请教一下,我已经按照步骤下载导入了,可一点反应都没有

    请问这是怎么回事?是我操作的问题?还是配置的问题?

    请赐教!!!谢谢

  2. #20 楼 · mafa · 2007-01-31 10:10

    vim里有没有这种功能啊?

  3. #19 楼 · wayneG · 2007-01-30 23:35

    我的原来也不行,后来加了个Ruby Content Assist就可以了。其实在keys中也就那么几个Command,来回试几下就解决了。

  4. #18 楼 · 李超群 · 2007-01-23 23:16

    俺一直都用Ctrl+Space.还是这个最快

  5. #17 楼 · ducken · 2007-01-23 16:36

    新版本的RadRails0.72,可以用TAB直接展开模版了? 我的是新版本, 怎么就不行啊. 还有我用Alt+/也不行...哭了!

  6. #16 楼 · netfishx · 2006-11-25 12:14

    我用的不是单独打包的radrails,是在eclipse下安装rdt和radrails插件 无奈的想哭了。直接等0.8版本再说吧

  7. #15 楼 · yfmine · 2006-11-25 00:34

    你的是RDT?不是RadRails?怎么还有个MyEclipse...不知道哦,要不我把我的.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.ui.workbench.prefs发出来,你用这个试试看.可能是原来的没删除?另外RadRails有个新版本了,在 http://www.radrails.org/build/integration/2006.11/I061116.1740/ 据说修正了很多bug,要不用这个试试?我去看看我的RadRails截图和你的是不是一样的...

    刚试验了一下,发现只要这一句:

    \r\n<keyBinding commandId\="org.rubypeople.rdt.ui.edit.text.ruby.content.assist.proposals" contextId\="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+/"/>
    

    就够了.界面上显示还是Ctrl+Space,但你在编辑.rb或者.rhtml时,按下Alt+/,都已经可以弹出下拉的模版菜单了...

    BTW:新版本的RadRails0.72,可以用TAB直接展开模版了.

  8. #14 楼 · netfishx · 2006-11-21 17:11

    奇怪了,我这里就是死活也不行

    我按照你的方法改过之后,看附件

  9. #13 楼 · yfmine · 2006-11-21 14:05

    netfishx writes:

    你这个明显还是没有解决啊,都说过了ruby编辑器的key本来就是可以设置的,rhtml的编辑器没找到设置key的地方

    那可有点奇怪了哈,我这里一切正常呢,可以看附件...

  10. #12 楼 · netfishx · 2006-11-18 10:24

    yfmine writes:

    直接修改D:\EclipseWorkSpace.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.ui.workbench.prefs里的快捷键呢? [code] \r\n<keyBinding commandId="org.eclipse.ui.edit.text.contentAssist.proposals" contextId="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId="org.radrails.db.ui.scheme.default" keySequence="ALT+/"/> \r\n<keyBinding commandId="org.rubypeople.rdt.ui.edit.text.ruby.content.assist.proposals" contextId="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence="ALT+/"/> \r\n<keyBinding commandId="org.eclipse.ui.edit.text.hippieCompletion" contextId="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence="ALT+."/> [/code] 不行就再把下面的一起加上 [code] \r\n<keyBinding commandId="org.eclipse.ui.edit.text.contentAssist.proposals" contextId="org.eclipse.ui.textEditorScope" keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence="ALT+/"/> \r\n<keyBinding commandId="org.eclipse.ui.edit.text.hippieCompletion" contextId="org.eclipse.ui.textEditorScope" keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence="ALT+."/> [/code] 我设置的ALT+.是wordComplete,ALT+/是contentAssist...

    你这个明显还是没有解决啊,都说过了ruby编辑器的key本来就是可以设置的,rhtml的编辑器没找到设置key的地方

  11. #11 楼 · xmx0632 · 2006-11-17 22:08

    airport writes:

    我的rb文件没有反应,rhtml里面能出来,这是怎么回事?

    可以试试把你的输入法的切换热键改为别的组合,不要是默认的ctrl+space应该就好了 :D

  12. #10 楼 · eastviking · 2006-11-16 15:50

    eclipse里面用RDT插件的,好像只能导入ruby的templete rhtml的有没有办法?

  13. #9 楼 · airport · 2006-11-16 13:54

    我的rb文件没有反应,rhtml里面能出来,这是怎么回事?

  14. #8 楼 · yfmine · 2006-11-16 10:58

    直接修改D:\EclipseWorkSpace.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.ui.workbench.prefs里的快捷键呢?

    
    \r\n<keyBinding commandId\="org.eclipse.ui.edit.text.contentAssist.proposals" contextId\="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId\="org.radrails.db.ui.scheme.default" keySequence\="ALT+/"/>
    \r\n<keyBinding commandId\="org.rubypeople.rdt.ui.edit.text.ruby.content.assist.proposals" contextId\="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+/"/>
    \r\n<keyBinding commandId\="org.eclipse.ui.edit.text.hippieCompletion" contextId\="org.rubypeople.rdt.ui.rubyEditorScope" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+."/>
    
    

    不行就再把下面的一起加上

    
    \r\n<keyBinding commandId\="org.eclipse.ui.edit.text.contentAssist.proposals" contextId\="org.eclipse.ui.textEditorScope" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+/"/>
    \r\n<keyBinding commandId\="org.eclipse.ui.edit.text.hippieCompletion" contextId\="org.eclipse.ui.textEditorScope" keyConfigurationId\="org.eclipse.ui.defaultAcceleratorConfiguration" keySequence\="ALT+."/>
    
    

    我设置的ALT+.是wordComplete,ALT+/是contentAssist...

  15. #7 楼 · dogstar · 2006-11-16 10:46

    song8159 writes:

    模板文件解压到哪个文件夹?

    随便哪个文件夹,只要你能找到。 :) 不过建议放到radrails目录里的某个地方。

  16. #6 楼 · dogstar · 2006-11-16 10:43

    0.8很值得期待,但是什么时候对象可以点出方法呢?

    radrails writes:

    Patch contributions and 0.8 news by matt - 10/25/2006 09:08 AM

    A few weeks ago, a guy named Brad Wilson sent a message to the mailing list with a patch that added a few things to the RHTML editor and the DB table editor. Since then, I've been working with Brad and he's contributed some more fixes and features. He's done an incredible job and I want to briefly outline his contributions:

    -Refresh button for DB table editor and re-use of editors for same tables -Context menu for Servers view -Sortable columns in Servers view -Toggle comment action for the RHTML editor -Parser for RHTML editor that builds a syntax tree -Outline view for the RHTML editor -Source formatter for the RHTML editor

    Brad has contributed the most code we've ever seen, by far. Much thanks to him from the entire team!

    I have been building on Brad's work, adding more options to the RHTML source formatter and enhancing the outline. I think the syntax tree will allow for some content assist in the editor, especially providing closing tags. An enhanced RHTML editor is just one of many features awaiting in the next 0.8 release. Recent work from RDT and JRuby will be included, such as Ruby refactoring and fast debugging. So stay tuned, there's a lot coming.

  17. #5 楼 · song8159 · 2006-11-16 10:08

    模板文件解压到哪个文件夹?

  18. #4 楼 · netfishx · 2006-11-16 09:28

    rhtml editer中默认快捷键是ctrl+

  19. #3 楼 · ShingU · 2006-11-15 19:59

    crazycode writes:

    需要修改吗?我这直接用Alt+/就可以调用template呀。 原来如此!

    一直把rhtml Editor的快捷键认为是rb Editor的快捷键!

  20. #2 楼 · crazycode · 2006-11-15 19:01

    需要修改吗?我这直接用Alt+/就可以调用template呀。

评论功能维护中,当前仅展示历史评论。