aboutsummaryrefslogtreecommitdiffstats
path: root/bin/xman
blob: 63f686a66d675c5265b145057bd2b9be8ff908a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# xmandoc MANPAGE - read manpage of possibly not installed package

SOCKS_PROXY=socks5://127.0.0.1:9050 xlocate "man/man..\?/$1\.[0-9]" 2>/dev/null |
	{ grep . || {
		echo "xmandoc: No entry for $1 found." 1>&2
		exit 1
	}; } |
	while read -r pkg page; do
		page=${page#* -> }
		# xbps-query --cat=$page ${pkg%-*} | mandoc -O width=205 -a
		SOCKS_PROXY=socks5://127.0.0.1:9995 xbps-query --cat=$page ${pkg%-*} |
			mandoc -O width=205 -c | col -b |
			vim - -M -R \
				-c 'set ft=man nomod nolist' \
				-c 'silent only' \
				-c 'colo iceberg' \
				-c 'highlight Normal ctermbg=None' \
				-c 'highlight lineNr ctermbg=16' \
				-c 'hi EndOfBuffer ctermbg=16' \
				+only
	done