質問

Is there a way to get RubyMine-like autoformatting in vim?

Example I have this code:

def some_method
  hash[:key  ] =  "hello"
end

def some_other_method
  x =  [ "hello",   "world"]
end

I want to hit something similar to Cmd+Shift+L (in RubyMine) and have vim output this:

def some_method
  hash[:key] = "hello"
end

def some_other_method
  x = ["hello", "world"]
end
役に立ちましたか?

解決

Nowadays we have a nice tool called rufo which will autoformat the code for you. You can run it automatically with tools like Neoformat

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top