summaryrefslogtreecommitdiff
path: root/perf/scroll.vim
blob: dcbbc75fec603213ff44f3e6ee8b35bfd56ffef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
set nocompatible	" Use Vim defaults instead of 100% vi compatibility
set backspace=indent,eol,start	" more powerful backspacing
set textwidth=0		" Don't wrap lines by default
set nobackup
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time

set t_Co=256
set t_Sf=[3%dm
set t_Sb=[4%dm

function Scroll(dir, windiv)
	let wh = winheight(0)
	let i = 1
	while i < wh / a:windiv
		let i = i + 1
		if a:dir == "d"
			normal j
		else
			normal k
		end
		" insert a character to force vim to update!
		normal I 
		redraw
		normal dl
	endwhile
endfunction

function WindowScroll(dir, windiv)
	let wh = winheight(0)
	let i = 1
	while i < wh * a:windiv
		let i = i + 1
		if a:dir == "d"
			normal j
		else
			normal k
		end
		" insert a character to force vim to update!
		normal I 
		redraw
		normal dl
	endwhile
endfunction

function AutoScroll(count)
	let loop = 0
	while loop < a:count
		let loop = loop + 1
		call Scroll("d", 1)
		call Scroll("u", 2)
		call Scroll("d", 2)
		call Scroll("u", 1)
		call Scroll("d", 2)
		call Scroll("u", 2)
	endwhile
	quit!
endfunction

function AutoWindowScroll(count)
	let loop = 0
	while loop < a:count
		let loop = loop + 1
		call WindowScroll("d", 10)
		call WindowScroll("u", 10)
	endwhile
	quit!
endfunction