3 # Purpose: "quick manual access"
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>, Matthias Kopfermann <maddi@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
9 . /etc/grml/lsb-functions
10 . /etc/grml/script-functions
12 check4progs man lzop vim || exit 1
16 MANDIR=${MANDIR:-$HOME/man}
17 if ! [ -d "$MANDIR" ] ; then
18 einfo "Creating $MANDIR."
19 mkdir $MANDIR ; eend $?
23 eerror "Usage: qma [section] manpage" ; eend 1
32 einfo "qma - version $VERSION" ; eend 0
49 if [ -z "$MANPAGE" ] ; then
53 QUICKMAN="${MANDIR}/${MANPAGE}${SECTIONFILE}.txt.lzo"
55 if ! [ -f "$QUICKMAN" ] ; then
56 einfo "Writing manpage to $QUICKMAN"
57 if man $SECTION $MANPAGE 1>/dev/null ; then
58 man $SECTION $MANPAGE | col -b | lzop -U >$QUICKMAN ; eend $?
59 einfo "Compressing manpage with lzop"
69 "set hlsearch can be annoying so use <C-L> to dehighlight"
70 "shut up hlsearch when it confuses more than it helps and"
71 nn <silent> <C-L> :nohlsearch<cr>|redraw
72 "q should really end our document-reading like less does"
74 "different than q in that it quits only the current window when multiple windows "
76 "honor midnight-commander addicts :) "
78 "use one wonderful vim feature to show all matches of the word in the document in ex-mode"
86 "scroll the page down one line"
88 "scroll the page up one line"
90 "the expectation of getting the next search via 'n' can not be ignored"
91 nn -n <ESC> :set invnumber<cr>
92 nn h :set invhlsearch<cr>
93 "Make toggling case-sensitive accessable via the letter i"
94 nn i :set invignorecase<cr>
95 "Make toggling case-sensitive accessable via the less convention via -i"
96 nn -i :set invignorecase<cr>
104 "Really not modify a document here"
107 "We have a more modern approach to searching in vim!"
111 if [ -n "$SEARCH" ] ; then
112 vim -S =( echo $vimconfig ) +/"$SEARCH" =( lzop -cd ${QUICKMAN} )
114 vim -S =( echo $vimconfig ) =( lzop -cd $QUICKMAN )
117 einfo "Thanks for flying qma using vim and lzop." ; eend 0
119 ## END OF FILE #################################################################