fix calling setting fileformat to happen as an autocommand

This commit is contained in:
JesseBot 2025-01-23 19:56:16 +01:00
parent b384c2d6a9
commit 4aedfbcdbf
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

View file

@ -7,8 +7,6 @@
-- turn off the mouse scrolling because it is confusing
vim.opt.mousescroll = 'ver:0,hor:0'
vim.api.nvim_command('set ff=unix')
-- line numbers for debugging and screen sharing, takes up 4 columns
vim.opt.number = true
vim.opt.numberwidth = 4

View file

@ -4,6 +4,14 @@ local autocmd = vim.api.nvim_create_autocmd
-- Autocommands to run immediately for for ALL file types --
------------------------------------------------------------
-- on file enter, set file format to unix
autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*"},
callback = function()
vim.cmd("set fileformat=unix")
end,
})
-- delete whitespace on save - https://vi.stackexchange.com/a/41388
autocmd({ "BufWritePre", "ExitPre" }, {
pattern = {"*"},
@ -14,7 +22,6 @@ autocmd({ "BufWritePre", "ExitPre" }, {
end,
})
-------------------------------------------------------------
-- Autocommands to run immediately for SPECIFIC file types --
-------------------------------------------------------------