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/c.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/ftplugin/c.lua') diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua index 0ddbf09470..2695b642aa 100644 --- a/runtime/ftplugin/c.lua +++ b/runtime/ftplugin/c.lua @@ -1,5 +1,5 @@ -- These are the default option values in Vim, but not in Nvim, so must be set explicitly. -vim.bo.commentstring = '/*%s*/' +vim.bo.commentstring = '// %s' vim.bo.define = '^\\s*#\\s*define' vim.bo.include = '^\\s*#\\s*include' -- cgit From 8f5e90811025bcc652146168d5116f8d73fe8f81 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 1 Jul 2024 17:48:09 +0800 Subject: fix(runtime): update b:undo_ftplugin in Lua runtime files (#29529) Related to #29506, but adding vim.treesitter.stop() to b:undo_ftplugin doesn't solve the problem yet. --- runtime/ftplugin/c.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/ftplugin/c.lua') diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua index 2695b642aa..6e68df18d0 100644 --- a/runtime/ftplugin/c.lua +++ b/runtime/ftplugin/c.lua @@ -11,4 +11,4 @@ if vim.fn.isdirectory('/usr/include') == 1 then ]]) end -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. '|setl path<' +vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl path<' -- 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/c.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/ftplugin/c.lua') diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua index 6e68df18d0..09e286201b 100644 --- a/runtime/ftplugin/c.lua +++ b/runtime/ftplugin/c.lua @@ -11,4 +11,4 @@ if vim.fn.isdirectory('/usr/include') == 1 then ]]) end -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl path<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring< define< include< path<' -- cgit