" Vim user support file to detect file types in scripts " Maintainer: Frank S. Thomas " Last Change: 2009-10-11 " Only do the rest when the FileType autocommand has not been triggered yet. if did_filetype() finish endif " SLHA: Try to find in the first 20 lines a BLOCK or DECAY block. We allow " blank lines and leading whitespace in comment-only lines although the spec " says such lines are data statements. let s:lnum = 0 while s:lnum < 20 && s:lnum < line("$") let s:lnum += 1 let s:line = getline(s:lnum) if s:line =~? '^\(BLOCK\s\+[A-Z\d]\+\|DECAY\)' set ft=slha break elseif s:line !~? '\(^\s*#\|^\s*$\)' break endif endwhile