Group autocmd + add filetype specific settings.
Move functions out to its own file.