/[gentoo-x86]/eclass/vim-doc.eclass
Gentoo

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Fri Feb 18 19:11:02 2005 UTC (9 years, 5 months ago) by ciaranm
Branch: MAIN
Changes since 1.6: +9 -10 lines
fix help tags

1 vapier 1.5 # Copyright 1999-2004 Gentoo Foundation
2 agriffis 1.1 # Distributed under the terms of the GNU General Public License v2
3 ciaranm 1.7 # $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.6 2005/02/03 21:12:41 agriffis Exp $
4 agriffis 1.1 #
5     # This eclass is used by vim.eclass and vim-plugin.eclass to update
6     # the documentation tags. This is necessary since vim doesn't look in
7     # /usr/share/vim/vimfiles/doc for documentation; it only uses the
8     # versioned directory, for example /usr/share/vim/vim62/doc
9     #
10     # We depend on vim being installed, which is satisfied by either the
11     # DEPEND in vim-plugin or by whatever version of vim is being
12     # installed by the eclass.
13    
14     ECLASS=vim-doc
15     INHERITED="$INHERITED $ECLASS"
16    
17     update_vim_helptags() {
18     local vimfiles vim d s
19    
20     # This is where vim plugins are installed
21     vimfiles=/usr/share/vim/vimfiles
22    
23 agriffis 1.6 if [[ $PN != vim-core ]]; then
24 ciaranm 1.7 # Find a suitable vim binary for updating tags :helptags
25     if use ppc-macos ; then
26     vim=$(which gvim 2>/dev/null )
27     else
28     vim=$(which vim 2>/dev/null)
29     [[ -z "$vim" ]] && vim=$(which gvim 2>/dev/null)
30     [[ -z "$vim" ]] && vim=$(which kvim 2>/dev/null)
31     fi
32 agriffis 1.6 if [[ -z "$vim" ]]; then
33     ewarn "No suitable vim binary to rebuild documentation tags"
34     fi
35 agriffis 1.1 fi
36    
37     # Install the documentation symlinks into the versioned vim
38     # directory and run :helptags
39     for d in /usr/share/vim/vim[0-9]*; do
40     [[ -d "$d/doc" ]] || continue # catch a failed glob
41    
42     # Remove links, and possibly remove stale dirs
43     find $d/doc -name \*.txt -type l | while read s; do
44 agriffis 1.6 [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
45 agriffis 1.1 done
46 agriffis 1.4 if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
47 agriffis 1.1 # /usr/share/vim/vim61
48     # /usr/share/vim/vim61/doc
49     # /usr/share/vim/vim61/doc/tags
50     einfo "Removing $d"
51     rm -r "$d"
52     continue
53     fi
54    
55     # Re-create / install new links
56 agriffis 1.2 if [[ -d $vimfiles/doc ]]; then
57     ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
58 agriffis 1.1 fi
59    
60     # Update tags; need a vim binary for this
61     if [[ -n "$vim" ]]; then
62     einfo "Updating documentation tags in $d"
63     DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
64     '+set nobackup nomore' \
65     "+helptags $d/doc" \
66     '+qa!' </dev/null &>/dev/null
67     fi
68     done
69     }

  ViewVC Help
Powered by ViewVC 1.1.20