let s:autoformat= system("source ~/.summerConfig/setting && echo -n $AUTO_FORMAT") function FormatCode() let current_cursor_position = getpos(".") %!clang-format -style=google call setpos('.', current_cursor_position) endfunction if s:autoformat== "yes" " autocmd BufWritePre *.cc,*.cpp,*.h :silent! %!clang-format -style=google autocmd BufWritePre *.cc,*.cpp,*.h call FormatCode() endif