summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-09-12 21:20:04 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-09-12 21:20:04 +0200
commit0b133fdd8d867f8affddf27d4227fed2eb2157a9 (patch)
tree6900306f52931bc8c2dd626327d9da17bac99277
parent2d378bfb31273ab7fbd9bcddd2e77c84283484db (diff)
nvim: Properly disable auto-commenting
-rw-r--r--.config/nvim/lua/mango/set.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/.config/nvim/lua/mango/set.lua b/.config/nvim/lua/mango/set.lua
index 28c5cf2..9428df5 100644
--- a/.config/nvim/lua/mango/set.lua
+++ b/.config/nvim/lua/mango/set.lua
@@ -1,4 +1,5 @@
local lib = require('mango.lib')
+local api = vim.api
local opt = vim.opt
opt.nu = true
@@ -29,8 +30,17 @@ opt.updatetime = 50
opt.colorcolumn = '81'
--- Disable auto commenting
-vim.bo.formatoptions = 'jnql'
-
opt.splitright = true
opt.splitbelow = true
+
+-- Disable auto commenting
+local group = api.nvim_create_augroup('Mango', { clear = true })
+api.nvim_create_autocmd(
+ 'BufEnter',
+ {
+ callback = function()
+ opt.formatoptions:remove({'c', 'r', 'o'})
+ end,
+ group = group,
+ }
+)