Closed pezcore closed 2 years ago
I believe I have found a workaround to this issue. Adding
vim.api.nvim_del_augroup_by_name("_format_options")
to the end of config.lua
will delete the offending augroup (defined here), and allow setting formatoptions
to contain c
and/or r
and/or o
.
But I wonder why does this augroup exist in the first place? Are there any features that actually depend on it? It seems pretty detrimental to LunarVim because it basically hijacks user configurability of formatoptions
and makes it impossible for the user to set c
, r
, or o
in their formatoptions
. There is no info in the LunarVim documentation regarding this behavior or how to disable/override it, and discovering this workaround was rather challenging and time consuming for me.
I think at the very least, the LunarVim Documentation should explain that this behavior exists (since it is not standard Nvim behavior) and give instructions on how to disable/override it properly in the user config.
Or perhaps the augroup definition should be removed from LunarVim altogether, I can't really see the benefit of it.
Just ran into this. I'd like to see that autogroup removed too, there is no reason for it to exist.
It does seem irregular
Hey,
This is really annoying for me, and I was wondering if there is any new information on this?
This issue is stale because it has been open for 30 days with no activity.
this has changed in #2592
you can add this to your config.lua
pcall(vim.api.nvim_del_augroup_by_name, "_format_options")
Problem description
When opening a file with
The
formatoptions
value (as shown by:echo &fo
) isvqnlj
, but it is desired forformaoptions
to contain the much-needed flagc
(otherwise formatting doc comments is very painful). This is the case despite attempts to set thec
flag inconfig.lua
on the advice of @abzcoding in #2232:This is the only change to an otherwise completely stock, fresh install of lunarvim.
The reason for this undesired behavior (inability to have
c
flag set informatoptions
) is this code. In general it should be possible to override and/or disable any option or behavior provided by lunarvim by modifyingconfig.lua
, but it appears that because of the mentioned code block, this is not possible as thec
,r
, ando
flags are always removed fromformatoptions
whenever a new file is opened.LunarVim version
master-47e4e5b
Neovim version (>= 0.7.2)
NVIM v0.7.2
Operating system/version
Manjaro Linux 5.15.57-2-MANJARO x86_64 GNU/Linux
Steps to reproduce
config.lua
to enable thec
flag informatoptions
:lvim filename
and check the result of:echo &fo
,c
is not presentsupport info
LspInfo
LvimInfo
Screenshots
No response