mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
27 lines
634 B
Lua
27 lines
634 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)
|
|
|
|
-- Wrap markdown lines when a buffer is written.
|
|
vim.api.nvim_create_autocmd(
|
|
"BufWritePre",
|
|
{
|
|
pattern = { "*.md", "*.markdown" },
|
|
command = ":normal ggVGgq",
|
|
group = vim.api.nvim_create_augroup("MyMarkdownLineWrapper", { clear = true })
|
|
}
|
|
)
|
|
|