Frage

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
War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top