summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/tools/clang-format/clang-format.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py
index 0c772f91f6f..976c222df05 100644
--- 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 <C-I> :pyf <path-to-this-file>/clang-format.py<cr>
-# imap <C-I> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
+# if has('python')
+# map <C-I> :pyf <path-to-this-file>/clang-format.py<cr>
+# imap <C-I> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
+# elseif has('python3')
+# map <C-I> :py3f <path-to-this-file>/clang-format.py<cr>
+# imap <C-I> <c-o>:py3f <path-to-this-file>/clang-format.py<cr>
+# 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 <path-to-this-file>/clang-format.py
+# : if has('python')
+# : pyf <path-to-this-file>/clang-format.py
+# : elseif has('python3')
+# : py3f <path-to-this-file>/clang-format.py
+# : endif
# :endfunction
#
# It operates on the current, potentially unsaved buffer and does not create
OpenPOWER on IntegriCloud