File: scroll.vim

package info (click to toggle)
vte2.91 0.82.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,944 kB
  • sloc: cpp: 96,516; ansic: 8,991; python: 3,082; sh: 996; perl: 100; makefile: 86; xml: 27; javascript: 4
file content (68 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download | duplicates (15)
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