I am following along in the book Vi IMproved by Steve Oualline.
In Chapter 7, "Commands for Programmers", there is a discussion about indentation and the =
command.
Here is what I wrote in my file
{
if True
return 1;
statement;
statement;
}
Then, as instructed by the book, I positioned my cursor on the first "{" and pressed "=%". The result was
{
if True
return 1;
statement;
statement;
}
The book shows only the content within the braces being indented.
Why is the closing brace being indented?
=
command (e.g.=%
or=G
) depend on your file type and your file type implementation. Your problem is probably laying there. Could you share your file type with us (:set filetype
)?$ vim --version
might be relevant, too. Both the example from the book and the example from OP work as expected, here.