[llvm] [vim] set commentstring (PR #71838)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 09:56:19 PST 2023


https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/71838

>From 22e9848fe2987ec165cc360cc475a61b355f1d5c Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 9 Nov 2023 10:23:22 -0800
Subject: [PATCH 1/2] [vim] set commentstring

I recently moved from using vim to lunarvim. I noticed that `gcc` (lol)
wasn't able to comment out lines, because commentstring is not set.

Thanks to Chase Colman for the suggestion in
https://github.com/LunarVim/LunarVim/issues/4394.
---
 llvm/utils/vim/syntax/llvm.vim | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/utils/vim/syntax/llvm.vim b/llvm/utils/vim/syntax/llvm.vim
index d86e3d1ddbc27ff..bf08bbc5cb58f6c 100644
--- a/llvm/utils/vim/syntax/llvm.vim
+++ b/llvm/utils/vim/syntax/llvm.vim
@@ -270,3 +270,5 @@ if version >= 508 || !exists("did_c_syn_inits")
 endif
 
 let b:current_syntax = "llvm"
+
+setlocal commentstring=;\ %s

>From 4e231b774127af3a9501e02177b28e7eb57db33f Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Fri, 17 Nov 2023 09:56:05 -0800
Subject: [PATCH 2/2] use ftplugin rather than syntax per @chase

---
 llvm/utils/vim/ftplugin/llvm.vim | 1 +
 llvm/utils/vim/syntax/llvm.vim   | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/utils/vim/ftplugin/llvm.vim b/llvm/utils/vim/ftplugin/llvm.vim
index bdf49c92ff22bc9..55315159c18bce8 100644
--- a/llvm/utils/vim/ftplugin/llvm.vim
+++ b/llvm/utils/vim/ftplugin/llvm.vim
@@ -10,3 +10,4 @@ let b:did_ftplugin = 1
 setlocal softtabstop=2 shiftwidth=2
 setlocal expandtab
 setlocal comments+=:;
+setlocal commentstring=;\ %s
diff --git a/llvm/utils/vim/syntax/llvm.vim b/llvm/utils/vim/syntax/llvm.vim
index bf08bbc5cb58f6c..d86e3d1ddbc27ff 100644
--- a/llvm/utils/vim/syntax/llvm.vim
+++ b/llvm/utils/vim/syntax/llvm.vim
@@ -270,5 +270,3 @@ if version >= 508 || !exists("did_c_syn_inits")
 endif
 
 let b:current_syntax = "llvm"
-
-setlocal commentstring=;\ %s



More information about the llvm-commits mailing list