summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2018-03-13 15:05:40 -0600
committerTuowen Zhao <ztuowen@gmail.com>2018-03-13 15:05:40 -0600
commit6206cbfb71a39048314314d9d0f00e97a43b95f2 (patch)
treef51754f41a4706689d4b4cced438e7c9a025b755
parente8ed3462bb066dbbf4860c378ee2d657896a2857 (diff)
downloadvim-6206cbfb71a39048314314d9d0f00e97a43b95f2.tar.gz
vim-6206cbfb71a39048314314d9d0f00e97a43b95f2.tar.bz2
vim-6206cbfb71a39048314314d9d0f00e97a43b95f2.zip
Add clang-format
-rw-r--r--.gitmodules3
m---------bundle/clang-format0
-rw-r--r--config/clang-format.vim11
3 files changed, 14 insertions, 0 deletions
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
+Subproject 8ff1660a1e9f856479fffe693743521f4f3068c
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 <Leader>cf in C++ code
+ autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
+ autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
+augroup END