[clang] 9741ac5 - [clang-format] vim integration: Mention python3 variant of bindings

Jannik Silvanus via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 08:18:44 PDT 2023


Author: Jannik Silvanus
Date: 2023-06-21T17:18:36+02:00
New Revision: 9741ac5b3b3e7942e3332e37af829e58e5e2bb82

URL: https://github.com/llvm/llvm-project/commit/9741ac5b3b3e7942e3332e37af829e58e5e2bb82
DIFF: https://github.com/llvm/llvm-project/commit/9741ac5b3b3e7942e3332e37af829e58e5e2bb82.diff

LOG: [clang-format] vim integration: Mention python3 variant of bindings

The instructions in the documentation only mentioned how to include
bindings for clang-format into vim using python2. Add the instructions
for python3 which were already present in the source comments.

Differential Revision: https://reviews.llvm.org/D153338

Change-Id: I25fdbd36f0c7e745061908be8e26f68cb31c7dd5

Added: 
    

Modified: 
    clang/docs/ClangFormat.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index 98350a04ccda4..129d5f101a0c4 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -145,8 +145,13 @@ This can be integrated by adding the following to your `.vimrc`:
 
 .. code-block:: vim
 
-  map <C-K> :pyf <path-to-this-file>/clang-format.py<cr>
-  imap <C-K> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
+  if has('python')
+    map <C-K> :pyf <path-to-this-file>/clang-format.py<cr>
+    imap <C-K> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
+  elseif has('python3')
+    map <C-K> :py3f <path-to-this-file>/clang-format.py<cr>
+    imap <C-K> <c-o>:py3f <path-to-this-file>/clang-format.py<cr>
+  endif
 
 The first line enables :program:`clang-format` for NORMAL and VISUAL mode, the
 second line adds support for INSERT mode. Change "C-K" to another binding if


        


More information about the cfe-commits mailing list