|
|
|
-- Remove any trailing whitespace from the file on write
|
|
vim.api.nvim_create_autocmd({ 'BufWritePre' }, { command = [[%s/\s\+$//e]] })
|
|
|
|
-- Load file on last line
|
|
-- TODO: change this to use lua
|
|
vim.api.nvim_create_autocmd({ 'BufRead' }, {
|
|
command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
|
|
})
|
|
|
|
-- Save session on VimLeave
|
|
vim.api.nvim_create_autocmd({ 'VimLeave' }, {
|
|
command = [[mksession! ~/.config/nvim/session/shutdown_session.vim]]
|
|
})
|
|
|
|
-- Set tabs to 2 for dart, vue, and js files
|
|
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
|
|
pattern = { '*.dart', '*.vue', '*.js' },
|
|
callback = function()
|
|
vim.o.tabstop = 2
|
|
vim.o.softtabstop = 2
|
|
vim.o.shiftwidth = 2
|
|
end
|
|
})
|
|
|
|
-- Ensure to read .docker files as a dockerfile
|
|
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
|
|
pattern = { '*.docker' },
|
|
callback = function()
|
|
vim.o.syntax = 'dockerfile'
|
|
end
|
|
})
|
|
|