当我在vim中格式化PHP文件时没问题,但是当我格式化Ruby文件时,VIM格式代码不好。糟糕的格式化Vim中的ruby代码
例如:
class PostsController < ApplicationController
skip_before_filter :authorize, :only => [ :index, :show ]
def index
@posts = Post.all
end
def show
@post = Post.find(:first, :conditions => [ "id = ?", params[:id]], :include => [ :user, :category, :gallery ])
@photos = Photo.where(:gallery_id => @post.gallery.id).all
end
end
当我输入命令GG = G,我得到。
class PostsController < ApplicationController
skip_before_filter :authorize, :only => [ :index, :show ]
def index
@posts = Post.all
end
def show
@post = Post.find(:first, :conditions => [ "id = ?", params[:id]], :include => [ :user, :category, :gallery ])
@photos = Photo.where(:gallery_id => @post.gallery.id).all
end
end
请帮帮我。
你使用vim红宝石?这可能有所帮助:https://github.com/vim-ruby/vim-ruby –