Skip to content

Instantly share code, notes, and snippets.

@dahu
Created February 28, 2015 01:39
Show Gist options
  • Select an option

  • Save dahu/1aefc1700de639922065 to your computer and use it in GitHub Desktop.

Select an option

Save dahu/1aefc1700de639922065 to your computer and use it in GitHub Desktop.
Set the filetype of some.type.dist to <type>
" Barry Arthur, Feb 2015
" Set the filetype of some.type.dist to <type>
function! DistFiletype()
augroup DistFiletype
exe 'au BufEnter ' . expand('<afile>') . ' set filetype=' . matchstr(expand('<afile>:t'), '\.\zs\w\+\ze\.dist$') . ' | au! DistFiletype'
augroup END
endfunction
au BufNew,BufRead *.dist call DistFiletype()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment