| 
									
										
										
										
											2022-02-09 21:50:44 +00:00
										 |  |  | vim9script noclear | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 21:50:44 +00:00
										 |  |  | # Vim support file to switch on loading plugins for file types | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Maintainer:	Bram Moolenaar <Bram@vim.org> | 
					
						
							| 
									
										
										
										
											2022-02-11 13:29:40 +00:00
										 |  |  | # Last change:	2022 Feb 11 | 
					
						
							| 
									
										
										
										
											2022-02-09 21:50:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if exists("g:did_load_ftplugin") | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2022-02-09 21:50:44 +00:00
										 |  |  | g:did_load_ftplugin = 1 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | augroup filetypeplugin | 
					
						
							| 
									
										
										
										
											2022-02-09 21:50:44 +00:00
										 |  |  |   au FileType * call LoadFTPlugin() | 
					
						
							| 
									
										
										
										
											2022-02-04 19:48:06 +00:00
										 |  |  | augroup END | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 21:50:44 +00:00
										 |  |  | if exists('*LoadFTPlugin') | 
					
						
							|  |  |  |   # No need to define the function again. | 
					
						
							|  |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def LoadFTPlugin() | 
					
						
							| 
									
										
										
										
											2022-02-04 19:48:06 +00:00
										 |  |  |   if exists("b:undo_ftplugin") | 
					
						
							| 
									
										
										
										
											2022-02-11 13:29:40 +00:00
										 |  |  |     # We assume b:undo_ftplugin is using legacy script syntax | 
					
						
							|  |  |  |     legacy exe b:undo_ftplugin | 
					
						
							| 
									
										
										
										
											2022-02-04 19:48:06 +00:00
										 |  |  |     unlet! b:undo_ftplugin b:did_ftplugin | 
					
						
							|  |  |  |   endif | 
					
						
							| 
									
										
										
										
											2006-03-18 21:40:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-04 19:48:06 +00:00
										 |  |  |   var s = expand("<amatch>") | 
					
						
							|  |  |  |   if s != "" | 
					
						
							|  |  |  |     if &cpo =~# "S" && exists("b:did_ftplugin") | 
					
						
							|  |  |  |       # In compatible mode options are reset to the global values, need to | 
					
						
							|  |  |  |       # set the local values also when a plugin was already used. | 
					
						
							|  |  |  |       unlet b:did_ftplugin | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |     endif | 
					
						
							| 
									
										
										
										
											2022-02-04 19:48:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # When there is a dot it is used to separate filetype names.  Thus for | 
					
						
							|  |  |  |     # "aaa.bbb" load "aaa" and then "bbb". | 
					
						
							|  |  |  |     for name in split(s, '\.') | 
					
						
							|  |  |  |       exe 'runtime! ftplugin/' .. name .. '.vim ftplugin/' .. name .. '_*.vim ftplugin/' .. name .. '/*.vim' | 
					
						
							|  |  |  |     endfor | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  | enddef |