This is not really a "Vim answer", but it is in my humble opinion the "correct answer".
We tend to forget style guide while editing files. Auto reminding would be a great feature.
So how would this work? Every five minutes you get a message with "hey, don't forget to use the style guide"? Is this really helpful? Because to me it sounds like:
It distracts the programmer from whatever she's working on right now. Programming is hard and requires a lot of short-term memory. Distractions erase part of that short-term memory and it'll take time to "catch up" again.
People are not going to keep paying attention to messages shown regularly. They tend to ignore those. you could make the messages more "in your face", but that would only increase problem 1.
If you absolutely must do something from within Vim, then use syntastic. This allows you to run automated syntax and style checkers whenever you write the file to disk with :w
.
Syntastic is a great plugin for checking syntax errors as it allows quick feedback on typos and other errors that really do need to be fixed right now to allow the code to run, but I feel that it's harmful for notifications of style errors for the same reason as above: it breaks the concentration on the actual important and hard parts of programming. Is it really important that that space gets fixed now? I would say not.
I joked about the clippy program in the comments. It was wildly perceived as spectacularly annoying precisely because it distracted people's concentration from the actual important task at hand (such as writing a letter).
The best way to fix this is to set a pre-commit hook in your version control system (mercurial, git, subversion, SCCS, whatever. You are using one, right?) That way the flow of operations is:
- Programming receives task.
- Programmer works to fix the task.
- A tester or programmer discovers bugs, works until they're fixed.
- Programmer fixes some "lint" such as style errors.
That way, there is a "separation" between the actual programming (step 2) and fixing the style errors (step 4) in such a way that doesn't distract from the actual important and hard task at hand (step 2).
Ideally, such a pre-commit hook only checks for errors when committing to the main branch(es) and not individual "private" branches.
If setting this up is too much work for now, then just run the tools from the commandline. Setting up a notification to do so with a pre-commit hook is easy, although the "people tend to ignore repeated warnings" still applies here (but you could perhaps echo it in red and have it wait for ten seconds or some such).
Lastly, perhaps you should reconsider your "style guide". I have seen some style guides that dwarf several Bible books and contain all sorts of pedantic details. There are a few truly important things everyone should agree on, but other than that I find that it doesn't really aid much in readability (and slavish obedience to style guides for the sake of it may even harm readability in some cases).
This answer summarized in a cartoon:
