Skip to content

Commit 05a0c2d

Browse files
committed
chore(neovim): allow to disable autoformat
1 parent 0baa00c commit 05a0c2d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

git/gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
vendor/bundle/ruby
77
.vscode
88
.claude
9+
*.disable-autoformat

nvim/lua/config/autocmds.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ vim.api.nvim_create_autocmd("BufWritePre", {
166166
vim.api.nvim_create_autocmd("BufWritePre", {
167167
pattern = "*",
168168
callback = function(args)
169+
local root = vim.fn.getcwd()
170+
if vim.fn.filereadable(root .. "/.disable-autoformat") == 1 then
171+
print("Autoformat disabled for this project")
172+
return
173+
end
169174
require("conform").format({ bufnr = args.buf })
170175
end,
171176
})

0 commit comments

Comments
 (0)