2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								" Vim support file to detect file types in scripts  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Maintainer:	Bram Moolenaar <Bram@vim.org>  
						 
					
						
							
								
									
										
										
										
											2020-03-14 08:19:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" Last change:	2020 Mar 06  
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" This file is called by an autocommand for every file that has just been  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" loaded into a buffer.  It checks if the type of file can be recognized by  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" the file contents.  The autocommand is in $VIMRUNTIME/filetype.vim.  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Note that the pattern matches are done with =~# to avoid the value of the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" 'ignorecase' option making a difference.  Where case is to be ignored use  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" =~? instead.  Do not use =~ anywhere.  
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Only do the rest when the FileType autocommand has not been triggered yet.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  did_filetype ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  finish 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								endif  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Load the user defined scripts file first  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Only do this when the FileType autocommand has not been triggered yet  
						 
					
						
							
								
									
										
										
										
											2005-05-20 21:31:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  exists ( "myscriptsfile" )  && filereadable ( expand ( myscriptsfile ) )  
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  execute  "source "  . myscriptsfile 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  did_filetype ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    finish 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								endif  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Line continuation is used here, remove 'C' from 'cpoptions'  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								let  s :cpo_save  =  &cpo  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								set  cpo &vim  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								let  s :line1  =  getline ( 1 )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  s :line1  = ~ # "^#!"  
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  " A script that starts with "#!".  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Check for a line like "#!/usr/bin/env VAR=val bash".  Turn it into  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " "#!/usr/bin/bash" to make matching easier.  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  s :line1  = ~ # '^#!\s*\S*\<env\s' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    let  s :line1  =  substitute ( s :line1 ,  '\S\+=\S\+' ,  '' ,  'g' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    let  s :line1  =  substitute ( s :line1 ,  '\<env\s\+' ,  '' ,  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Get the program name.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Only accept spaces in PC style paths: "#!c:/program files/perl [args]".  
						 
					
						
							
								
									
										
										
										
											2005-05-20 21:31:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " If the word env is used, use the first word after the space:  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " "#!/usr/bin/env perl [path/args]"  
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  " If there is no path use the first word: "#!perl [path/args]".  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]".  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  s :line1  = ~ # '^#!\s*\a:[/\\]' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    let  s :name  =  substitute ( s :line1 ,  '^#!.*[/\\]\(\i\+\).*' ,  '\1' ,  '' ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^#!.*\<env\>' 
							 
						 
					
						
							
								
									
										
										
										
											2005-05-20 21:31:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    let  s :name  =  substitute ( s :line1 ,  '^#!.*\<env\>\s\+\(\i\+\).*' ,  '\1' ,  '' ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    let  s :name  =  substitute ( s :line1 ,  '^#!\s*\([^/\\ ]*\>\).*' ,  '\1' ,  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    let  s :name  =  substitute ( s :line1 ,  '^#!\s*\S*[/\\]\(\i\+\).*' ,  '\1' ,  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-08-08 18:54:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " tcl scripts may have #!/bin/sh in the first line and "exec wish" in the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " third line.  Suggested by Steven Atkinson.  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  getline ( 3 )  = ~ # '^exec wish' 
							 
						 
					
						
							
								
									
										
										
										
											2006-08-08 18:54:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    let  s :name  =  'wish' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-09-02 19:12:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Bourne-like shell scripts: bash bash2 ksh ksh93 sh  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  s :name  = ~ # '^\(bash\d*\|\|ksh\d*\|sh\)\>' 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-11 15:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    call  dist #ft #SetFileTypeSH ( s :line1 ) 	" defined in filetype.vim 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " csh scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^csh\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  exists ( "g:filetype_csh" ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-11 15:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      call  dist #ft #SetFileTypeShell ( g :filetype_csh ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-11 15:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      call  dist #ft #SetFileTypeShell ( "csh" ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " tcsh scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^tcsh\>' 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-11 15:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    call  dist #ft #SetFileTypeShell ( "tcsh" ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Z shell scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^zsh\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = zsh 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " TCL scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = tcl 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Expect scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^expect\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = expect 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Gnuplot scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^gnuplot\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = gnuplot 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Makefiles  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'make\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = make 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-28 22:47:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Pike  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^pike\%(\>\|[0-9]\)' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set  ft = pike 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-05-20 21:31:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Lua  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'lua' 
							 
						 
					
						
							
								
									
										
										
										
											2005-05-20 21:31:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = lua 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-29 23:12:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Perl 6  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'perl6' 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-29 23:12:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = perl6 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " Perl  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'perl' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = perl 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " PHP  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'php' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = php 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Python  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'python' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = python 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Groovy  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^groovy\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = groovy 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Ruby  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'ruby' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = ruby 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 17:04:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " JavaScript  
						 
					
						
							
								
									
										
										
										
											2018-02-03 22:35:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'node\(js\)\=\>\|js\>'  | |  s :name  = ~ # 'rhino\>' 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 17:04:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = javascript 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " BC calculator  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # '^bc\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = bc 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " sed  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'sed\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = sed 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " OCaml-scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'ocaml' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = ocaml 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Awk scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'awk\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = awk 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Website MetaLanguage  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'wml' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = wml 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Scheme scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'scheme' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = scheme 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-10-12 21:01:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " CFEngine scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'cfengine' 
							 
						 
					
						
							
								
									
										
										
										
											2005-10-12 21:01:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = cfengine 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-06 21:36:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Erlang scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'escript' 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-06 21:36:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = erlang 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 17:04:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Haskell  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'haskell' 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 17:04:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = haskell 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Scala  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'scala\>' 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 17:04:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = scala 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-03 15:43:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Clojure  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :name  = ~ # 'clojure' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set  ft = clojure 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  unlet  s :name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								else  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " File does not start with "#!".  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  s :line2  =  getline ( 2 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  s :line3  =  getline ( 3 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  s :line4  =  getline ( 4 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  s :line5  =  getline ( 5 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Bourne-like shell scripts: sh ksh bash bash2  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  s :line1  = ~ # '^:$' 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-11 15:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    call  dist #ft #SetFileTypeSH ( s :line1 ) 	" defined in filetype.vim 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-25 21:34:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Z shell scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^#compdef\>'  | |  s :line1  = ~ # '^#autoload\>'  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        \ "\n" .s :line1 ."\n" .s :line2 ."\n" .s :line3 ."\n" .s :line4 ."\n" .s :line5  = ~ # '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = zsh 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " ELM Mail files  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = mail 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-25 21:34:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Mason  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^<[%&].*>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = mason 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-25 21:34:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Vim scripts (must have '" vim' as the first line to trigger this)  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^" *[vV]im$' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = vim 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-25 21:34:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " libcxx and libstdc++ standard library headers like "iostream" do not have  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " an extension, recognize the Emacs file mode.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ ? '-\*-.*C++.*-\*-' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set  ft = cpp 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " MOO  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = moo 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Diff file:  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "diff" in first line (context diff)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "Only in " in first line  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "--- " in first line and "+++ " in second line (unified diff).  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "*** " in first line and "--- " in second line (context diff).  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "# It was generated by makepatch " in the second line (makepatch diff).  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "Index: <filename>" in the first line (CVS file)  
						 
					
						
							
								
									
										
										
										
											2006-03-26 21:06:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " - "=== ", line of "=", "---", "+++ " (SVK diff)  
						 
					
						
							
								
									
										
										
										
											2006-03-28 21:08:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " - "=== ", "--- ", "+++ " (bzr diff, common case)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " - "=== (removed|added|renamed|modified)" (bzr diff, alternative)  
						 
					
						
							
								
									
										
										
										
											2012-09-21 14:54:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " - "# HG changeset patch" in first line (Mercurial export format)  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\(diff\>\|Only in \|\d\+\(,\d\+\)\=[cda]\d\+\>\|# It was generated by makepatch \|Index:\s\+\f\+\r\=$\|===== \f\+ \d\+\.\d\+ vs edited\|==== //\f\+#\d\+\|# HG changeset patch\)' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  ( s :line1  = ~ # '^--- '  && s :line2  = ~ # '^+++ ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  ( s :line1  = ~ # '^\* looking for '  && s :line2  = ~ # '^\* comparing to ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  ( s :line1  = ~ # '^\*\*\* '  && s :line2  = ~ # '^--- ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  ( s :line1  = ~ # '^=== '  && ( ( s :line2  = ~ # '^=\{66\}'  && s :line3  = ~ # '^--- '  && s :line4  = ~ # '^+++' )  | |  ( s :line2  = ~ # '^--- '  && s :line3  = ~ # '^+++ ' ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  ( s :line1  = ~ # '^=== \(removed\|added\|renamed\|modified\)' ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = diff 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " PostScript Files (must have %!PS as the first line, like a2ps output)  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^%![ \t]*PS' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = postscr 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " M4 scripts: Guess there is a line that starts with "dnl".  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\s*dnl\>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line2  = ~ # '^\s*dnl\>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line3  = ~ # '^\s*dnl\>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line4  = ~ # '^\s*dnl\>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line5  = ~ # '^\s*dnl\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = m4 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " AmigaDos scripts  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  $TERM  = =  "amiga" 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									\ && ( s :line1  = ~ # "^;"  | |  s :line1  = ~ ? '^\.bra' ) 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = amiga 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " SiCAD scripts (must have procn or procd as the first line to trigger this)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ ? '^ *proc[nd] *$' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set  ft = sicad 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Purify log files start with "****  Purify"  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\*\*\*\*  Purify' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = purifylog 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " XML  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '<?\s*xml.*?>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = xml 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN")  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '\<DTD\s\+XHTML\s' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = xhtml 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-25 03:04:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")  
						 
					
						
							
								
									
										
										
										
											2016-05-24 20:02:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Avoid "doctype html", used by slim.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ ? '<!DOCTYPE\s\+html\>' 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-25 03:04:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = html 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-25 20:13:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " PDF  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^%PDF-' 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-25 20:13:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = pdf 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " XXD output  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} ' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = xxd 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " RCS/CVS log output  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^RCS file:'  | |  s :line2  = ~ # '^RCS file:' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = rcslog 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " CVS commit  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line2  = ~ # '^CVS:'  | |  getline ( "$" )  = ~ # '^CVS: ' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = cvs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-03-04 23:39:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    " Prescribe  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^!R!' 
							 
						 
					
						
							
								
									
										
										
										
											2005-03-04 23:39:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = prescribe 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " Send-pr  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^SEND-PR:' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = sendpr 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " SNNS files  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^SNNS network definition file' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = snnsnet 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^SNNS pattern definition file' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = snnspat 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^SNNS result file' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = snnsres 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Virata  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^%.\{-}[Vv]irata' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line2  = ~ # '^%.\{-}[Vv]irata' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line3  = ~ # '^%.\{-}[Vv]irata' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line4  = ~ # '^%.\{-}[Vv]irata' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line5  = ~ # '^%.\{-}[Vv]irata' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = virata 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " Strace  
						 
					
						
							
								
									
										
										
										
											2017-08-27 16:52:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '[0-9:.]* *execve('  | |  s :line1  = ~ # '^__libc_start_main' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = strace 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " VSE JCL  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\* $$ JOB\>'  | |  s :line1  = ~ # '^// *JOB\>' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = vsejcl 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " TAK and SINDA  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line4  = ~ # 'K & K  Associates'  | |  s :line2  = ~ # 'TAK 2000' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = takout 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line3  = ~ # 'S Y S T E M S   I M P R O V E D ' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = sindaout 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  getline ( 6 )  = ~ # 'Run Date: ' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = takcmp 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  getline ( 9 )  = ~ # 'Node    File  1' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = sindacmp 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " DNS zone files  
						 
					
						
							
								
									
										
										
										
											2017-11-02 22:58:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1 .s :line2 .s :line3 .s :line4  = ~ # '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA' 
							 
						 
					
						
							
								
									
										
										
										
											2006-03-25 22:05:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = bindzone 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " BAAN  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '|\*\{1,80}'  && s :line2  = ~ # 'VRC ' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									\ | |  s :line2  = ~ # '|\*\{1,80}'  && s :line3  = ~ # 'VRC ' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = baan 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Valgrind  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^==\d\+== valgrind'  | |  s :line3  = ~ # '^==\d\+== Using valgrind' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = valgrind 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-08-29 15:12:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Go docs  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^PACKAGE DOCUMENTATION$' 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-29 15:12:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = godoc 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  " Renderman Interface Bytestream  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^##RenderMan' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = rib 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " Scheme scripts  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # 'exec\s\+\S*scheme'  | |  s :line2  = ~ # 'exec\s\+\S*scheme' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    set  ft = scheme 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-25 20:13:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Git output  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-25 20:13:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set  ft = git 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-01 14:50:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   " Gprof (gnu profiler)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   elseif  s :line1  = =  'Flat profile:' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     \ && s :line2  = =  '' 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     \ && s :line3  = ~ # '^Each sample counts as .* seconds.$' 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-01 14:50:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     set  ft = gprof 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-06 21:36:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " Erlang terms  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  " (See also: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html#Choosing-Modes)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ ? '-\*-.*erlang.*-\*-' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set  ft = erlang 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-06 22:25:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  " YAML  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  elseif  s :line1  = ~ # '^%YAML' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set  ft = yaml 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  " CVS diff  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  else 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 20:54:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    let  s :lnum  =  1 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    while  getline ( s :lnum )  = ~ # "^? "  && s :lnum  <  line ( "$" ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 20:54:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      let  s :lnum  + =  1 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    endwhile 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  getline ( s :lnum )  = ~ # '^Index:\s\+\f\+$' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      set  ft = diff 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " locale input files: Formal Definitions of Cultural Conventions  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " filename must be like en_US, fr_FR@euro or en_US.UTF-8  
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    elseif  expand ( "%" )  = ~ # '\a\a_\a\a\($\|[.@]\)\|i18n$\|POSIX$\|translit_' 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 20:54:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      let  s :lnum  =  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      while  s :lnum  <  100  && s :lnum  <  line ( "$" ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-11 17:10:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  getline ( s :lnum )  = ~ # '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$' 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									  setf  fdcc 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									  break 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									endif 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 20:54:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									let  s :lnum  + =  1 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      endwhile 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    endif 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 20:54:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    unlet  s :lnum 
							 
						 
					
						
							
								
									
										
										
										
											2004-06-13 20:20:40 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  endif 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  unlet  s :line2  s :line3  s :line4  s :line5 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								endif  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" Restore 'cpoptions'  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								let  &cpo  =  s :cpo_save  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								unlet  s :cpo_save  s :line1