1

I have installed the vim-latexsuite and vim-outliner packages, which are addons for vim. Both come with documentation files, that are installed into the /usr/share/vim/addons/doc directory. Issuing the 'help' command from within vim, the documentation is not availabe, because it had not been installed properly. This might apply to other addons as well.

How can I create the help tags for these addons that I expected to be created by the installation routine?

0
2

I was able to solve the problem in two steps.

  1. Since vim had not been able to generate the required index from the compressed documentation, I extracted these files before re-running the indexer. As vim is able to deal with compressed documentation, I removed the extracted documents and adjusted the filenames of the index accordingly.
#!/bin/bash

#set -x
set -e

umask 077 
TMPTAGS=$(mktemp --tmpdir "`basename "$0"`.XXXXXXXXXXXX")
trap "rm -f '$TMPTAGS'" EXIT

declare -r AWK_SCRIPT='{ if( $2 in files ) $2=$2".gz"; print }'

helptags(){
        # extract zipped helpfiles and remember filenames
        local -i I=0 
        local -a TXT 
        for ZIP in `find . -xtype f \( -name '*.txt.gz' -o -name '*.??x.gz' \)`; do
                T=${ZIP%.gz}
                if [ -n "$T" ]; then
                        TXT[$((I++))]=$T
                        zcat "$ZIP" >"$T"
                fi
        done
        # generate tagfiles
        vim -c 'helptags .' +q
        # point tags to the zipped helpfiles
        local AWK_BEGIN="BEGIN { OFS=FS; "
        while [ $((I--)) -gt 0 ]; do
                AWK_BEGIN+="files[\"`basename "${TXT[$I]}"`\"]; "
        done
        AWK_BEGIN+='}'
        for T in `find . -xtype f \( -name 'tags' -o -name 'tags-??' \)`; do
                awk -F '\t' "$AWK_BEGIN $AWK_SCRIPT" "$T" >"$TMPTAGS"
                mv -f "$TMPTAGS" "$T"
        done
        # remove unzipped helpfiles
        for T in "${TXT[@]}"; do
                rm -f "$T"
        done
}

while [ $# -gt 0 ]; do
        if [ -d "$1" ]; then
                pushd "$1" >/dev/null
                helptags
                popd >/dev/null
        else
                printf '*** Invalid argument: %s\n' "$1" >&2 
        fi
        shift
done
  1. Finally, I have appended /usr/share/vim/addons to the runtimpath variables in /usr/share/vim/vim74/debian.vim and /etc/vim/vimrc.tiny.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy