From 6206cbfb71a39048314314d9d0f00e97a43b95f2 Mon Sep 17 00:00:00 2001 From: Tuowen Zhao Date: Tue, 13 Mar 2018 15:05:40 -0600 Subject: Add clang-format --- .gitmodules | 3 +++ bundle/clang-format | 1 + config/clang-format.vim | 11 +++++++++++ 3 files changed, 15 insertions(+) create mode 160000 bundle/clang-format create mode 100644 config/clang-format.vim diff --git a/.gitmodules b/.gitmodules index f90e52b..11d4f4e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,3 +31,6 @@ [submodule "bundle/unite"] path = bundle/unite url = https://github.com/Shougo/unite.vim.git +[submodule "bundle/clang-format"] + path = bundle/clang-format + url = https://github.com/rhysd/vim-clang-format.git diff --git a/bundle/clang-format b/bundle/clang-format new file mode 160000 index 0000000..8ff1660 --- /dev/null +++ b/bundle/clang-format @@ -0,0 +1 @@ +Subproject commit 8ff1660a1e9f856479fffe693743521f4f3068cb diff --git a/config/clang-format.vim b/config/clang-format.vim new file mode 100644 index 0000000..7ccd24a --- /dev/null +++ b/config/clang-format.vim @@ -0,0 +1,11 @@ +let g:clang_format#style_options = { + \ "AccessModifierOffset" : -4, + \ "AllowShortIfStatementsOnASingleLine" : "true", + \ "AlwaysBreakTemplateDeclarations" : "true", + \ "Standard" : "C++11"} + +augroup ClangFormatSettings + " map to cf in C++ code + autocmd FileType c,cpp,objc nnoremap cf :ClangFormat + autocmd FileType c,cpp,objc vnoremap cf :ClangFormat +augroup END -- cgit v1.2.3-70-g09d2