diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2023-06-06 11:26:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 11:26:29 -0500 |
commit | fcfe535e9877cfdc824dc78f2d19e590400d34cd (patch) | |
tree | 2867033645aa2830356580f7248f02156216926b /runtime/ftplugin/c.lua | |
parent | 4382d2ed564b80944345785d780cf1b19fb23ba8 (diff) | |
download | rneovim-fcfe535e9877cfdc824dc78f2d19e590400d34cd.tar.gz rneovim-fcfe535e9877cfdc824dc78f2d19e590400d34cd.tar.bz2 rneovim-fcfe535e9877cfdc824dc78f2d19e590400d34cd.zip |
refactor(defaults): do not use C specific default values for options (#22500)
The options 'path', 'include', and 'define' all use C-specific default
values. This may have made sense a long time ago when Vim was mostly
used just for writing C, but this is no longer the case, and we have
ample support for filetype specific configuration. Make the default
values of these options empty and move the C-specific values into a
filetype plugin where they belong.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'runtime/ftplugin/c.lua')
-rw-r--r-- | runtime/ftplugin/c.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua index b4e68148f5..0ddbf09470 100644 --- a/runtime/ftplugin/c.lua +++ b/runtime/ftplugin/c.lua @@ -1 +1,14 @@ +-- 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<' |