autocmd BufNewFile,BufRead *.swift setfiletype swift

autocmd BufNewFile,BufRead *.swift setfiletype swift
autocmd BufRead * call s:Swift()
function! s:Swift()
  if !empty(&filetype)
    return
  endif

  let line = getline(1)
  if line =~ "^#!.*swift"
    setfiletype swift
  endif
endfunction

Read first line for shebang
Read first line for shebang

mokagio/swift.vim,aclissold/swift.vim,keith/swift.vim,gfontenot/swift.vim,ajh17/swift.vim,michaelnisi/swift.vim,panghea/swift.vim