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.

33 lines
1011 B

  1. -- Remove any trailing whitespace from the file on write
  2. vim.api.nvim_create_autocmd({ 'BufWritePre' }, { command = [[%s/\s\+$//e]] })
  3. -- Load file on last line
  4. -- TODO: change this to use lua
  5. vim.api.nvim_create_autocmd({ 'BufRead' }, {
  6. command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
  7. })
  8. -- Save session on VimLeave
  9. vim.api.nvim_create_autocmd({ 'VimLeave' }, {
  10. command = [[mksession! ~/.config/nvim/session/shutdown_session.vim]]
  11. })
  12. -- Set tabs to 2 for dart, vue, and js files
  13. vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
  14. pattern = { '*.dart', '*.vue', '*.js' },
  15. callback = function()
  16. vim.o.tabstop = 2
  17. vim.o.softtabstop = 2
  18. vim.o.shiftwidth = 2
  19. end
  20. })
  21. -- Ensure to read .docker files as a dockerfile
  22. vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
  23. pattern = { '*.docker' },
  24. callback = function()
  25. vim.o.syntax = 'dockerfile'
  26. end
  27. })