From 054a287dbe6fe4308d26ec593da2057641f2bb9b Mon Sep 17 00:00:00 2001 From: Soham Shanbhag Date: Mon, 3 Jun 2024 16:48:43 +0900 Subject: feat(ftplugin): change 'commentstring' to `// %s` for C/C++ (#29085) Problem: The default commentstring for C/C++ can lead to invalid code when commenting and does not match the Nvim codebase. Solution: Change commentstring to `// %s` as used by Neovim. Also set all commentstrings that derive from the default C string explicitly (and correctly). --- runtime/ftplugin/ch.lua | 1 + 1 file changed, 1 insertion(+) create mode 100644 runtime/ftplugin/ch.lua (limited to 'runtime/ftplugin/ch.lua') diff --git a/runtime/ftplugin/ch.lua b/runtime/ftplugin/ch.lua new file mode 100644 index 0000000000..f398d66a63 --- /dev/null +++ b/runtime/ftplugin/ch.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '// %s' -- cgit From 50577534318bbf8c1e22e80a74baa3b20c131ea8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 Sep 2024 16:49:34 +0800 Subject: fix(runtime): treat b:undo_ftplugin consistently in Lua ftplugins (#30473) - Don't assume b:undo_ftplugin is set when first modifying it. - Don't assume b:undo_ftplugin already contains some resetting. --- runtime/ftplugin/ch.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/ftplugin/ch.lua') diff --git a/runtime/ftplugin/ch.lua b/runtime/ftplugin/ch.lua index f398d66a63..89ab42ef54 100644 --- a/runtime/ftplugin/ch.lua +++ b/runtime/ftplugin/ch.lua @@ -1 +1,3 @@ vim.bo.commentstring = '// %s' + +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' -- cgit