[llvm] [vim] Set commentstring for TableGen files (PR #182654)

Henry Baba-Weiss via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 21:01:57 PST 2026


https://github.com/henrybw created https://github.com/llvm/llvm-project/pull/182654

Neovim supports [commenting and uncommenting lines](https://neovim.io/doc/user/various.html#commenting) based on what the 'commentstring' option is set to, but this isn't set for TableGen files. The filetype plugin for C++ built into both vim and neovim sets 'commentstring' to `// %s`, so use that in the TableGen filetype plugin as well.

>From 2ab04ca6c6c34f1ea6f82b24f662c41c5bce9788 Mon Sep 17 00:00:00 2001
From: Henry Baba-Weiss <henry.babaweiss at gmail.com>
Date: Fri, 20 Feb 2026 21:00:00 -0800
Subject: [PATCH] [vim] Set commentstring for TableGen files

Neovim supports [commenting and uncommenting lines](https://neovim.io/doc/user/various.html#commenting)
based on what the 'commentstring' option is set to, but this isn't set for
TableGen files. The filetype plugin for C++ built into both vim and neovim sets
'commentstring' to `// %s`, so use that in the TableGen filetype plugin as well.
---
 llvm/utils/vim/ftplugin/tablegen.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/utils/vim/ftplugin/tablegen.vim b/llvm/utils/vim/ftplugin/tablegen.vim
index cfae846c818b8..497958bfe1dbc 100644
--- a/llvm/utils/vim/ftplugin/tablegen.vim
+++ b/llvm/utils/vim/ftplugin/tablegen.vim
@@ -10,3 +10,4 @@ let b:did_ftplugin = 1
 setlocal matchpairs+=<:>
 setlocal softtabstop=2 shiftwidth=2
 setlocal expandtab
+setlocal commentstring=//\ %s



More information about the llvm-commits mailing list