diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py --- a/clang/tools/clang-format/clang-format.py +++ b/clang/tools/clang-format/clang-format.py @@ -2,11 +2,19 @@ # - Change 'binary' if clang-format is not on the path (see below). # - Add to your .vimrc: # -# map :pyf /clang-format.py -# imap :pyf /clang-format.py +# if has('python') +# map :pyf /clang-format.py +# imap :pyf /clang-format.py +# elseif has('python3') +# map :py3f /clang-format.py +# imap :py3f /clang-format.py +# endif # -# The first line enables clang-format for NORMAL and VISUAL mode, the second -# line adds support for INSERT mode. Change "C-I" to another binding if you +# The if-elseif-endif conditional should pick either the python3 or python2 +# integration depending on your vim setup. +# +# The first mapping enables clang-format for NORMAL and VISUAL mode, the second +# mapping adds support for INSERT mode. Change "C-I" to another binding if you # need clang-format on a different key (C-I stands for Ctrl+i). # # With this integration you can press the bound key and clang-format will @@ -20,7 +28,11 @@ # like: # :function FormatFile() # : let l:lines="all" -# : pyf /clang-format.py +# : if has('python') +# : pyf /clang-format.py +# : elseif has('python3') +# : py3f /clang-format.py +# : endif # :endfunction # # It operates on the current, potentially unsaved buffer and does not create