Search code examples
linuxvimg++c++14spf13vim

Vim(spf13) auto debug when save


Vim "spf13" offer a plug-in that when you try to save the file in vim (:w), it will show all compile error on left(by red arrow). For example, when I open a ".cc" file and try to save it(:w), the vim will show all error information same as when you "g++" it. but some of my code use c++14 style(e.g.: shared_ptr). So I want change the default compiler of this plug-in to g++ -std=c++14. (I don't know the plug-in name), so what should I do?


Solution

  • From what I could find, spf13 is basically just vim preconfigured with other plugins that exist already. So your real question isn't about spf13, but the syntax checking plugin that it uses, which appears to be Syntastic. For a quick fix let g:syntastic_cpp_compiler_options = ' -std=c++14' should probably do the trick. I would recommend looking more into syntastic's settings so you can configure it on a per-project basis with .syntastic files.

    If you are feeling a little more ambitious to break out of the plugins spf13 comes pre-configured with, I have become a fan of ALE: The Asyncronous Lint Engine which makes use of Vim8's jobs to lint in the background instead of freezing while it lints.