I am trying to format some groovy code in vim
Firstly I the command type “:set smartindent”
… then I type the command “:=%”
and the error I get is the following:
E488: Trailing characters
Here is the code I am trying to format:
import groovy.util.GroovyTestCase
class MyTest extends GroovyTestCase {
void testSomething() {
assert 1 == 1
assert 2 + 2 == 4 : "We're in trouble, arithmetic is broken"
}
}
What am I doing wrong???
Any help appreciated. Thanks.
I don’t think that
:=%is supposed to work because%is not a motion.If you want to format the whole file, you should rather use
gg=GOtherwise, select an area and use
=, for examplevi}=, you don’t have to enter command mode to reformat (Command mode is when you are entering:)