Tuesday, April 16, 2013

How to wait for VIM to finish parsing document?

I'm writing a small Vimscript that will open a number of files, indent them (gg=G), and then save them.

I've noticed that oftentimes, the first couple of files do not get indented correctly, even if the command works fine when executed manually. It looks as if the indentation command is being executed before the file is fully parsed, or perhaps before the syntax plugin finishes loading.

I've tried adding a manual "sleep" to the beginning of the command, but this doesn't seem to make a difference.

Anyone know what might be causing this issue, and how I can force VIM to finish loading plugins / parsing before the command runs?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: