To add on: oftentimes people lose where they were after they use gg=G. Another nice trick would be to save your current position in a mark first (, say, "mx"), then "gg=G", then jump back to mark with "`x" (that's a back-tick). Note that x can be any letter.
To add on: oftentimes people lose where they were after they use gg=G. Another nice trick would be to save your current position in a mark first (, say, "mx"), then "gg=G", then jump back to mark with "`x" (that's a back-tick). Note that x can be any letter.
I think the usefulness of this varies on the language. In most cases you are better of setting up an LSP if able, setting formatexpr, and using gq.