1
#!/bin/zsh
2
3
if [ $# -eq 0 ]; then
4
	echo "What manual page do you want?"
5
	exit 1
6
else
7
	if echo $1 | grep -Eq '[0-9]' && [ $# -eq 2 ]; then
8
		man -w $2 &>/dev/null || {
9
			echo "No entry for $2 in section $1 of the manual"
10
			exit 1
11
		}
12
	elif [ $# -eq 1 ]; then
13
		man -w $1 &>/dev/null || {
14
			echo "man page for $@ not found"
15
			exit 1
16
		}
17
	else
18
		echo "sorry, man more than two pages at once is not implemented yet..."
19
		exit 126
20
	fi
21
22
	vim -nR -S =(
23
	echo -n "
24
	:set nonu
25
	:set foldcolumn=2
26
	:nmap q :q!<CR>
27
	:runtime ftplugin/man.vim
28
	:Man $@
29
	:wincmd j
30
	:clo
31
	")
32
fi