You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
1.1 KiB

-- Remove any trailing whitespace from the file on write
vim.api.nvim_create_autocmd({ 'BufWritePre' }, { command = [[%s/\s\+$//e]] })
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
pattern = { '*.go' },
callback = function () require('go.format').gofmt() end,
})
-- 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
})