拡張子とファイルタイプ
拡張子とファイルタイプの対応づけは$VIMRUNTIME/filetype.vimに定義されているようだ。
Vim documentation: filetype
http://www.ac.cyberhome.ne.jp/~yakahaira/vimdoc/filetype.html
詳細: ":filetype on"コマンドは次のファイルのうち1つをロードする。
MS-DOS $VIMRUNTIME\filetype.vim
Unix $VIMRUNTIME/filetype.vim
このファイルはBufNewFileとBufReadイベントに対する自動実行コマンドを定
義するVimスクリプトファイルである。ファイル形式がファイル名から決定で
きない時には、ファイルの内容を検出するために$VIMRUNTIME/scripts.vimが
使用される。
というわけで、filetype.vimの中の*.plのところを見てみる。
if has("fname_case") au BufNewFile,BufRead *.pl,*.PL call s:FTpl() else au BufNewFile,BufRead *.pl call s:FTpl() endif au BufNewFile,BufRead *.plx setf perl func! s:FTpl() if exists("g:filetype_pl") exe "setf " . g:filetype_pl else " recognize Prolog by specific text in the first non-empty line " require a blank after the '%' because Perl uses "%list" and "%translate" let l = getline(nextnonblank(1)) if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' setf prolog else setf perl endif endif endfunc