summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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