[clang] Update ClangFormat.rst (PR #109380)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 23:22:01 PDT 2024


https://github.com/love1angel created https://github.com/llvm/llvm-project/pull/109380

latest vim such as 9.1 remove python and add python3 dependency

>From 1dfa78f2f5f0f873ddc41687158dc48588527035 Mon Sep 17 00:00:00 2001
From: helianthus <45203165+love1angel at users.noreply.github.com>
Date: Fri, 20 Sep 2024 14:18:57 +0800
Subject: [PATCH] Update ClangFormat.rst

pyf not work properly in vim 9.0+
---
 clang/docs/ClangFormat.rst | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index dbd9c91ae508e5..41e06558e1b45c 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -198,9 +198,12 @@ your `.vimrc`:
 
   function! Formatonsave()
     let l:formatdiff = 1
-    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
   endfunction
-  autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave()
+  autocmd BufWritePre *.h,*.cc,*.cpp,*.cppm call Formatonsave()
 
 
 Emacs Integration



More information about the cfe-commits mailing list