使用Vim Rails,你能一次性创建一个新的迁移文件并打开它吗?
使用vim和Rails插件,可以创建一个迁移文件,然后一次性打开该文件吗?
这对于 textmate 也可能吗?
Using vim with the Rails plugin, can you create a migration file and then open the file in one go?
Was this possible with textmate also?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 rails.vim 然后执行以下操作:
该插件将打开迁移生成的文件,这正是您想要的。我不能代表短信说话。
You could use rails.vim and then do something like:
The plugin will open the migration generated file, that's exactly what you want. I can't speak for textmate.
我不使用 Vim,但这是唯一这样的问题。下面是我如何从 Rails 命令行执行此操作(这些说明适用于 vim 或任何其他可以从命令行打开文本文件的编辑器):
我将此方法添加到我的
supermanpatches.rb
railsapp/config/initializers 内的文件来打开我最新生成的迁移(在 TextMate 中),而无需复制并粘贴文件名或类似的内容(从这个问题中获得一些帮助:如何使用 Ruby 获取目录中最后创建的文件的路径?)‡:(仅供 ruby/rails 初学者参考,初始化代码无处不在并且不需要从 Rails 内的任何位置访问类到文件名的范围)
I don't use Vim, but this is the only question like this on SO. So here's how I'm doing this from the rails command line (these instructions would work for vim or any other editor that can open text files from the command line):
I added this method to my
supermanpatches.rb
file inside ofrailsapp/config/initializers
to open my latest generated migration (in TextMate) without having to copy and paste the filename or anything like that (got some help from this question: How can I get the path for the last created file in a directory using Ruby?)‡: (FYI for ruby/rails beginners, initializer code is omnipresent and requires no class-to-filename scoping to be accessible from anywhere within rails)