From 2b50e68c7e2fb5df831f83ba89a7bd088629e1aa Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 18 Nov 2017 18:59:03 +0000 Subject: [PATCH] Add an FAQ entry explaining how to configure C or C++ projects --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 25fb72b..481e95a 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ servers with similar enough protocols, like `tsserver`. 11. [How can I use the quickfix list instead of the loclist?](#faq-quickfix) 12. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint) 13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad) + 14. [How can I configure my C or C++ project?](#faq-c-configuration) @@ -614,3 +615,28 @@ still be an advantage. If you are still concerned, you can turn the automatic linting off altogether, including the option `g:ale_lint_on_enter`, and you can run ALE manually with `:ALELint`. + + + +### 5.xiv. How can I configure my C or C++ project? + +The structure of C and C++ projects varies wildly from project to project, with +many different build tools being used for building them, and many different +formats for project configuration files. ALE can run compilers easily, but +ALE cannot easily detect which compiler flags to use. + +Some tools and build configurations can generate +[compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html) +files. The `cppcheck`, `clangcheck` and `clangtidy` linters can read these +files for automatically determining the appropriate compiler flags to use. + +For linting with compilers like `gcc` and `clang`, and with other tools, you +will need to tell ALE which compiler flags to use yourself. You can use +different options for different projects with the `g:ale_pattern_options` +setting. Consult the documentation for that setting for more information. +`b:ale_linters` can be used to select which tools you want to run, say if you +want to use only `gcc` for one project, and only `clang` for another. + +You may also configure buffer-local settings for linters with project-specific +vimrc files. [local_vimrc](https://github.com/LucHermitte/local_vimrc) can be +used for executing local vimrc files which can be shared in your project.