Skip to content

Commit bb11a29

Browse files
committed
simplify implementation of :ClangFormatAutoToggle
1 parent 9e92523 commit bb11a29

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

plugin/clang_format.vim

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if exists('g:loaded_clang_format')
2-
finish
2+
finish
33
endif
44

55
try
@@ -19,15 +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-
function! ClangFormatAutoToggleFunc()
23-
if !exists("g:clang_format#auto_format") || g:clang_format#auto_format == 0
24-
let g:clang_format#auto_format = 1
25-
echo "Auto clang-format: enabled"
26-
else
27-
let g:clang_format#auto_format = 0
28-
echo "Auto clang-format: disabled"
29-
endif
30-
endfunction
31-
command! ClangFormatAutoToggle call ClangFormatAutoToggleFunc()
22+
command! ClangFormatAutoToggle let g:clang_format#auto_format = !g:clang_format#auto_format
3223

3324
let g:loaded_clang_format = 1

0 commit comments

Comments
 (0)