if exists("did_load_filetypes") finish endif augroup filetypedetect au BufNewFile,BufRead *.h call FTCheck_inform() augroup END " function to detect inform code (any extension) fun! FTCheck_inform() if getline(1) =~ "^!" setfiletype inform elseif getline(2) =~ "^!" setfiletype inform else let s:colnum = col('.') let s:linenum = line('.') call cursor(500, 1) if search('^\s*\(\h\w*\s*\)\=\[\(\h\w*\)\=\(\s\+\h\w*\)*\s*;', 'bW') > 0 setfiletype inform endif call cursor(s:linenum, s:colnum) endif endfun