Files
dotfiles/nvim/m-housh/lua/autocmd.lua
2023-09-23 22:40:47 -04:00

24 lines
514 B
Lua

-- Remove all trailing whitespace on save
vim.api.nvim_exec([[
augroup TrimWhiteSpace
au!
autocmd BufWritePre * :%s/\s\+$//e
augroup END
]], false)
-- Prevent new line to also start with a comment
vim.api.nvim_exec([[
augroup NewLineComment
au!
au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
augroup END
]], false)
vim.api.nvim_create_autocmd(
"BufWritePost",
{
pattern = { "*.swift" },
command=":silent exec '!swift-format --in-place %'"
}
)