neovim/runtime/ftplugin/c.lua
Soham Shanbhag 054a287dbe
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).
2024-06-03 09:48:43 +02:00

15 lines
400 B
Lua

-- These are the default option values in Vim, but not in Nvim, so must be set explicitly.
vim.bo.commentstring = '// %s'
vim.bo.define = '^\\s*#\\s*define'
vim.bo.include = '^\\s*#\\s*include'
if vim.fn.isdirectory('/usr/include') == 1 then
vim.cmd([[
setlocal path^=/usr/include
setlocal path-=.
setlocal path^=.
]])
end
vim.b.undo_ftplugin = vim.b.undo_ftplugin .. '|setl path<'