augroup typo3
    autocmd!

    " Clear some caches depending on files saved. Only works if cwd is document root

    autocmd BufWritePost **/*.xlf :silent !rm */**/cache/**/l10n/*
    autocmd BufWritePost **/*.yml,**/*.yaml :silent !rm */**/cache/**/yamlsettings_form*
    autocmd BufWritePost **/Classes/Domain/Model/News.php :silent !rm -rf */**/var/cache/code/news/*
    autocmd BufWritePost **/Configuration/Backend/Modules.php :silent !rm */**/cache/**/BackendModules*
    autocmd BufWritePost **/Configuration/Backend/Routes.php :silent !rm */**/cache/**/BackendRoutesFromPackages_* */**/cache/**/BackendRoutes_*
    autocmd BufWritePost **/Configuration/Extbase/Persistence/Classes.php :silent !rm */**/cache/data/extbase/*
    autocmd BufWritePost **/Configuration/Icons.php :silent !rm */**/cache/**/Icons_*
    autocmd BufWritePost **/Configuration/JavaScriptModules.php :silent !rm */**/cache/data/assets/ImportMap_*
    autocmd BufWritePost **/Configuration/JavaScriptModules.php :silent !rm */**/cache/data/assets/RequireJS_*
    autocmd BufWritePost **/Configuration/RequestMiddlewares.php :silent !rm */**/cache/**/middlewares_*
    autocmd BufWritePost **/Configuration/Services.yaml,**/Configuration/Services/*.yaml,**/Configuration/Services.php :silent !rm */**/cache/**/DependencyInjectionContainer_*
    autocmd BufWritePost **/Configuration/TCA/** :silent !rm */**/cache*/**/tca_base_*
    autocmd BufWritePost **/ContentBlocks/* :silent !rm **/var/cache/code/core/content-blocks.php
    autocmd BufWritePost **/ContentBlocks/* :silent !rm */**/cache*/**/tca_base_*
    autocmd BufWritePost **/Domain/Model/*.php :silent !rm */**/cache/data/extbase/*
    autocmd BufWritePost **/ext_localconf.php :silent !rm */**/cache*/**/ext_localconf_*
    autocmd BufWritePost **/ext_tables.php :silent !rm */**/cache*/**/ext_tables_*
    autocmd BufWritePost **/local_packages/**/Sites/**/*.yaml :silent !rm */**/cache/**/sites-configuration.php
    autocmd BufWritePost **/sites/**/*.yaml :silent !rm */**/cache/**/sites-configuration.php
    autocmd BufWritePost *.typoscript,*.tsconfig :silent !rm -rf */**/cache/**/typoscript/*

    autocmd BufEnter,BufRead **/de.*.xlf :setlocal spelllang=de
augroup END
