[PATCH] D38446: update comments in clang-format.py for python3 compatibility
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 05:19:34 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6bf9e88ae4a4: [clang-format] update comments in clang-format.py for python3 compatibility (authored by MyDeveloperDay).
Changed prior to commit:
https://reviews.llvm.org/D38446?vs=117280&id=228419#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D38446/new/
https://reviews.llvm.org/D38446
Files:
clang/tools/clang-format/clang-format.py
Index: clang/tools/clang-format/clang-format.py
===================================================================
--- clang/tools/clang-format/clang-format.py
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38446.228419.patch
Type: text/x-patch
Size: 1738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191108/68c4b851/attachment.bin>
More information about the cfe-commits
mailing list