When I copy code from another file, the formatting is messed up, like this: fun() { for(...) { for(...) { if(...) { } } } }How can I autoformat this code in vim?
if you are copying from another source, I suggest you use Notepad++ to format the code. However, if you are editing code in Vim and you want automatic indenting, do the following.