Skip to content

Commit 085561a

Browse files
committed
oops! forget adding messages
1 parent bb11a29 commit 085561a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

autoload/clang_format.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,15 @@ function! clang_format#enable_format_on_insert()
225225
endfunction
226226
" }}}
227227

228+
" toggle auto formatting {{{
229+
function! clang_format#toggle_auto_format()
230+
let g:clang_format#auto_format = !g:clang_format#auto_format
231+
if g:clang_format#auto_format
232+
echo "Auto clang-format: enabled"
233+
else
234+
echo "Auto clang-format: disabled"
235+
endif
236+
endfunction
237+
" }}}
228238
let &cpo = s:save_cpo
229239
unlet s:save_cpo

plugin/clang_format.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ augroup plugin-clang-format-auto-format
1919
autocmd FileType c,cpp,objc if g:clang_format#auto_formatexpr && !clang_format#is_invalid() | setlocal formatexpr=clang_format#replace(v:lnum,v:lnum+v:count-1) | endif
2020
augroup END
2121

22-
command! ClangFormatAutoToggle let g:clang_format#auto_format = !g:clang_format#auto_format
22+
command! ClangFormatAutoToggle call clang_format#toggle_auto_format()
2323

2424
let g:loaded_clang_format = 1

0 commit comments

Comments
 (0)