robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
96be8a2c4d
master
1let g: loaded_clipboard_provider = 2 2 3let g: test_clip = { '+' : [ '' ], '*' : [ '' ], } 4 5let s: methods = {} 6 7let g: cliplossy = 0 8let g: cliperror = 0 9 10" Count how many times the clipboard was invoked. 11let g: clip_called_get = 0 12let g: clip_called_set = 0 13 14function ! s: methods . get ( reg ) 15let g: clip_called_get += 1 16 17if g: cliperror 18return 0 19end 20if g: cliplossy 21" behave like pure text clipboard 22return g: test_clip [ a: reg ][ 0 ] 23else 24" behave like VIMENC clipboard 25return g: test_clip [ a: reg ] 26end 27endfunction 28 29function ! s: methods . set ( lines , regtype , reg ) 30let g: clip_called_set += 1 31 32if a: reg == '"' 33call s: methods . set ( a: lines , a: regtype , '+' ) 34call s: methods . set ( a: lines , a: regtype , '*' ) 35return 0 36end 37let g: test_clip [ a: reg ] = [ a: lines , a: regtype ] 38endfunction 39 40function ! provider#clipboard#Call ( method , args ) 41return call ( s: methods [ a: method ], a: args , s: methods ) 42endfunction