| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | " Vim script to clean the ll.xxxxx.add files of commented out entries | 
					
						
							|  |  |  | " Author:	Antonio Colombo, Bram Moolenaar | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  | " Last Update:	2008 Jun 3 | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Time in seconds after last time an ll.xxxxx.add file was updated | 
					
						
							| 
									
										
										
										
											2006-03-04 21:49:37 +00:00
										 |  |  | " Default is one second. | 
					
						
							|  |  |  | " If you invoke this script often set it to something bigger, e.g. 60 * 60 | 
					
						
							|  |  |  | " (one hour) | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | if !exists("g:spell_clean_limit") | 
					
						
							| 
									
										
										
										
											2006-03-04 21:49:37 +00:00
										 |  |  |   let g:spell_clean_limit = 1 | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Loop over all the runtime/spell/*.add files. | 
					
						
							| 
									
										
										
										
											2006-03-04 21:49:37 +00:00
										 |  |  | " Delete all comment lines, except the ones starting with ##. | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | for s:fname in split(globpath(&rtp, "spell/*.add"), "\n") | 
					
						
							|  |  |  |   if filewritable(s:fname) && localtime() - getftime(s:fname) > g:spell_clean_limit | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  |     if exists('*fnameescape') | 
					
						
							|  |  |  |       let s:f = fnameescape(s:fname) | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       let s:f = escape(s:fname, ' \|<') | 
					
						
							|  |  |  |     endif | 
					
						
							|  |  |  |     silent exe "tab split " . s:f | 
					
						
							|  |  |  |     echo "Processing" s:f | 
					
						
							| 
									
										
										
										
											2006-03-04 21:49:37 +00:00
										 |  |  |     silent! g/^#[^#]/d | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  |     silent update | 
					
						
							|  |  |  |     close | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  |     unlet s:f | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  |   endif | 
					
						
							|  |  |  | endfor | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  | unlet s:fname | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | echo "Done" |