Skip to content

Commit 8f075d1

Browse files
author
git apple-llvm automerger
committed
Merge commit '535b85368663' from apple/master into swift/master-next
2 parents 5da93c4 + 535b853 commit 8f075d1

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

clang/tools/clang-format/clang-format.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22
# - Change 'binary' if clang-format is not on the path (see below).
33
# - Add to your .vimrc:
44
#
5-
# map <C-I> :pyf <path-to-this-file>/clang-format.py<cr>
6-
# imap <C-I> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
5+
# if has('python')
6+
# map <C-I> :pyf <path-to-this-file>/clang-format.py<cr>
7+
# imap <C-I> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
8+
# elseif has('python3')
9+
# map <C-I> :py3f <path-to-this-file>/clang-format.py<cr>
10+
# imap <C-I> <c-o>:py3f <path-to-this-file>/clang-format.py<cr>
11+
# endif
712
#
8-
# The first line enables clang-format for NORMAL and VISUAL mode, the second
9-
# line adds support for INSERT mode. Change "C-I" to another binding if you
13+
# The if-elseif-endif conditional should pick either the python3 or python2
14+
# integration depending on your vim setup.
15+
#
16+
# The first mapping enables clang-format for NORMAL and VISUAL mode, the second
17+
# mapping adds support for INSERT mode. Change "C-I" to another binding if you
1018
# need clang-format on a different key (C-I stands for Ctrl+i).
1119
#
1220
# With this integration you can press the bound key and clang-format will
@@ -20,7 +28,11 @@
2028
# like:
2129
# :function FormatFile()
2230
# : let l:lines="all"
23-
# : pyf <path-to-this-file>/clang-format.py
31+
# : if has('python')
32+
# : pyf <path-to-this-file>/clang-format.py
33+
# : elseif has('python3')
34+
# : py3f <path-to-this-file>/clang-format.py
35+
# : endif
2436
# :endfunction
2537
#
2638
# It operates on the current, potentially unsaved buffer and does not create

0 commit comments

Comments
 (0)