File: altchan.bj

package info (click to toggle)
epic4 1%3A3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,756 kB
  • sloc: ansic: 56,285; makefile: 631; sh: 161; perl: 30
file content (39 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (10)
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
/*
	Copyright (c) 2003 David B. Kratter (BlackJac@EFNet)

	Version: 1.0.2003.12.02.1

	This will allow you to toggle between hidden windows 1 through 20 more
	easily. Press Esc+1 to toggle between windows 1 and 11, Esc+2 for win-
	dows 2 and 12, etc., up through Esc+0 for windows 10 and 20.
*/

alias toggle.window (number, void) {
	if (@number) {
		if (number) {
			@ :window = winnum() == number ? [1$number] : number
			if (winnum($window) != -1) {
				window swap $window
			} else {
				if (window < 10 && winnum(1$window) != -1) {
					window swap 1$window
				} else if (window > 10 && winnum($right(1 $window) != -1)) {
					window swap $right(1 $window)
				} else {
					xecho -c Window $window does not exist
				}
			}
		} else {
			@ :window = winnum() == 10 ? 20 : 10
			if (winnum($window) != -1) {
				window swap $window
			} else {
				xecho -c Window $window does not exist
			}
		}
	}
}

fe ($jot(0 9 1)) tt {
	bind ^[$tt parse_command toggle.window $tt
}