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: Mon Dez 04 22:54:47 CET 2006 [maddi]
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 | lzop -U >$QUICKMAN ; eend $?
60 einfo "Compressing manpage with lzop"
70 "set hlsearch can be annoying so use <C-L> to dehighlight"
71 nn <silent> <C-L> :nohlsearch<cr>|redraw "shut up hlsearch when it confuses more than it helps and"
72 nn q :qa!<cr> "q should really end our document-reading like less does"
73 nn Q :q!<cr> "different than q in that it quits only the current window when multiple windows "
74 nn <F10> :qa!<cr> "honor midnight-commander addicts :) "
75 nn a ]I "use one wonderful vim feature to show all matches of the word in the document in ex-mode"
76 nn A [I "the other way round"
81 nn j <C-E> "scroll the page down one line"
82 nn k <C-Y> "scroll the page up one line"
83 nn -n <ESC> :set invnumber<cr> "the expectation of getting the next search via 'n' can not be ignored"
84 nn h :set invhlsearch<cr>
85 nn i :set invignorecase<cr> "Make toggling case-sensitive accessable via the letter i"
86 nn -i :set invignorecase<cr> "Make toggling case-sensitive accessable via the less convention via -i"
94 set nomodifiable "Really not modify a document here"
98 if [ -n "$SEARCH" ] ; then
99 vim -S =( echo $vimconfig ) +/"$SEARCH" =( lzop -cd ${QUICKMAN} )
101 vim -S =( echo $vimconfig ) =( lzop -cd $QUICKMAN )
104 einfo "Thanks for flying qma using vim and lzop." ; eend 0
106 ## END OF FILE #################################################################