rails.vim命令记

:Rake 这个好记
:Redit 任意文件,相对路径
:Rlog 日志文件
:Rpreview 打开浏览器,http://localhost:3000
:Rtags 生成一个tag,要求ctags
:Rrefresh 刷新
:Rfind 查文件,可以不写.rb后缀
gf 这个命令超强,根据当前光标处内容跳转到文件,以下是详细例子(*代表光标):
Pos*t.find(:first)
=>    app/models/post.rb

has_many :c*omments
=>  app/models/comment.rb

link_to “Home”, :controller => :bl*og
=>    app/controllers/blog_controller.rb ~

<%= render :partial => ’sh*ared/sidebar’ %>
=>    app/views/shared/_sidebar.rhtml

<%= stylesheet_link_tag :scaf*fold %>
=>   public/stylesheets/scaffold.css

class BlogController < Applica*tionController
=>   app/controllers/application.rb

class ApplicationController < ActionCont*roller::Base
=>   …/action_controller/base.rb

fixtures :pos*ts
=> test/fixtures/posts.yml

layout :pri*nt
=>  app/views/layouts/print.rhtml

(In the Blog controller)
def li*st
=>   app/views/blog/list.rhtml

:A :R 也是跳文件的
Current file        Alternate file        Related file ~
model            unit test        related migration
controller (in method)    functional test        template (view)
template (view)        helper            controller (jump to method)
migration        previous migration    next migration
config/routes.rb    config/database.yml    config/environment.rb
直接打开
:Rmodel
:Rmigration
:Robserver
:Rfixtures
:Runittest
:Rcontroller
:Rhelper
:Rview
:Rlayout
:Rapi
:Rfunctionaltest
:Rstylesheet
:Rjavascript
:Rplugin
:Rlib
:Rtask
:Rintegrationtest

一个超强的:Rcommand,不介绍了,看help

:Rscript
:Rconsole
:Rgenerate
:Rserver
:Rserver! 强制运行,杀掉前面那个,相当于重启

重构:
:Rextract 简单说就是把rhtml中的一段提出来,变成子页面

项目结构
:Rproject 看上去有个左边项目结构树

surroud: 这个不是命令,而是一个插件,装好后就可以在rhtml中自动关闭<%%>

taglist: 这个插件相当于outline,但是它可以同时放多个文件

NERD_tree:这个插件就是浏览文件,有点项目的感觉。

posted @ 2009-05-20 19:14  麦飞  阅读(929)  评论(0编辑  收藏  举报