diff options
Diffstat (limited to 'docs/ClangFormat.rst')
-rw-r--r-- | docs/ClangFormat.rst | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/ClangFormat.rst b/docs/ClangFormat.rst index ed0e58e452d3..902afcd08ed5 100644 --- a/docs/ClangFormat.rst +++ b/docs/ClangFormat.rst @@ -120,6 +120,18 @@ entity. It operates on the current, potentially unsaved buffer and does not create or save any files. To revert a formatting, just undo. +An alternative option is to format changes when saving a file and thus to +have a zero-effort integration into the coding workflow. To do this, add this to +your `.vimrc`: + +.. code-block:: vim + + function! Formatonsave() + let l:formatdiff = 1 + pyf ~/llvm/tools/clang/tools/clang-format/clang-format.py + endfunction + autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave() + Emacs Integration ================= |