문제

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