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 # Latest change: Don Sep 20 21:56:52 CEST 2007 [mika]
8 ################################################################################
10 . /etc/grml/lsb-functions
11 . /etc/grml/script-functions
13 check4progs man lzop vim || exit 1
17 MANDIR=${MANDIR:-$HOME/man}
18 if ! [ -d "$MANDIR" ] ; then
19 einfo "Creating $MANDIR."
20 mkdir $MANDIR ; eend $?
24 eerror "Usage: qma [section] manpage" ; eend 1
33 einfo "qma - version $VERSION" ; eend 0
50 if [ -z "$MANPAGE" ] ; then
54 QUICKMAN="${MANDIR}/${MANPAGE}${SECTIONFILE}.txt.lzo"
56 if ! [ -f "$QUICKMAN" ] ; then
57 einfo "Writing manpage to $QUICKMAN"
58 if man $SECTION $MANPAGE 1>/dev/null ; then
59 man $SECTION $MANPAGE | col -b | lzop -U >$QUICKMAN ; eend $?
60 einfo "Compressing manpage with lzop"
70 "set hlsearch can be annoying so use <C-L> to dehighlight"
71 "shut up hlsearch when it confuses more than it helps and"
72 nn <silent> <C-L> :nohlsearch<cr>|redraw
73 "q should really end our document-reading like less does"
75 "different than q in that it quits only the current window when multiple windows "
77 "honor midnight-commander addicts :) "
79 "use one wonderful vim feature to show all matches of the word in the document in ex-mode"
87 "scroll the page down one line"
89 "scroll the page up one line"
91 "the expectation of getting the next search via 'n' can not be ignored"
92 nn -n <ESC> :set invnumber<cr>
93 nn h :set invhlsearch<cr>
94 "Make toggling case-sensitive accessable via the letter i"
95 nn i :set invignorecase<cr>
96 "Make toggling case-sensitive accessable via the less convention via -i"
97 nn -i :set invignorecase<cr>
105 "Really not modify a document here"
108 "We have a more modern approach to searching in vim!"
112 if [ -n "$SEARCH" ] ; then
113 vim -S =( echo $vimconfig ) +/"$SEARCH" =( lzop -cd ${QUICKMAN} )
115 vim -S =( echo $vimconfig ) =( lzop -cd $QUICKMAN )
118 einfo "Thanks for flying qma using vim and lzop." ; eend 0
120 ## END OF FILE #################################################################