initial commit
This commit is contained in:
		
							
								
								
									
										23
									
								
								exp.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								exp.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					fo
 | 
				
			||||||
 | 
					bar
 | 
				
			||||||
 | 
					bar
 | 
				
			||||||
 | 
					hello
 | 
				
			||||||
 | 
					bar
 | 
				
			||||||
 | 
					hello
 | 
				
			||||||
 | 
					hello
 | 
				
			||||||
 | 
					f
 | 
				
			||||||
 | 
					abcd
 | 
				
			||||||
 | 
					fo
 | 
				
			||||||
 | 
					hello
 | 
				
			||||||
 | 
					fo
 | 
				
			||||||
 | 
					bcd
 | 
				
			||||||
 | 
					hello world and ha ha ha
 | 
				
			||||||
 | 
					foo bar and ha ha ha
 | 
				
			||||||
 | 
					xdfadf bar and ha ha he
 | 
				
			||||||
 | 
					skafjds bar and ha ha ha
 | 
				
			||||||
 | 
					hello ha ha ha
 | 
				
			||||||
 | 
					foob and ha ha ha
 | 
				
			||||||
 | 
					skafjds bar and ha ha ha
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										28
									
								
								lc.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								lc.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					vim9script
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def GetMatch(b: string, l: string): list<any>
 | 
				
			||||||
 | 
					    var s = b
 | 
				
			||||||
 | 
					    while stridx(l, s) == -1
 | 
				
			||||||
 | 
					        s = strpart(s, 1)
 | 
				
			||||||
 | 
					        if strlen(s) == 0
 | 
				
			||||||
 | 
					            return [0, ""]
 | 
				
			||||||
 | 
					        endif
 | 
				
			||||||
 | 
					    endwhile
 | 
				
			||||||
 | 
					    const idx = stridx(l, s)
 | 
				
			||||||
 | 
					    const slen = strlen(s)
 | 
				
			||||||
 | 
					    return [slen, b .. strpart(l, idx + slen)]
 | 
				
			||||||
 | 
					enddef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export def WholeLineCompl(f: bool, b: string): any
 | 
				
			||||||
 | 
					    if f
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					    endif
 | 
				
			||||||
 | 
					    return getline(0, '$')
 | 
				
			||||||
 | 
					        ->sort()
 | 
				
			||||||
 | 
					        ->uniq()
 | 
				
			||||||
 | 
					        ->map( (_, v) => GetMatch(b, v) )
 | 
				
			||||||
 | 
					        ->sort( (x, y) => y[0] - x[0] )
 | 
				
			||||||
 | 
					        ->map( (_, v) => v[1] )
 | 
				
			||||||
 | 
					enddef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					setlocal completefunc=WholeLineCompl
 | 
				
			||||||
		Reference in New Issue
	
	Block a user