summaryrefslogtreecommitdiff
blob: 6488a82bc76e80a85f64817a302ce33f86bdaa04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Author: Ciaran McCreesh <ciaranm@gentoo.org>
#
# completion for gvim

_gvim()
{
    local cur prev cmd args

    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}
    cmd=${COMP_WORDS[0]}

    if [[ "${prev}" == "--servername" ]] ; then
        local servers
        servers=$(gvim --serverlist )
        COMPREPLY=( $( compgen -W "${servers}" -- $cur ) )

    elif [[ "${prev}" == -[uUi] ]] ; then
        COMPREPLY=( $( compgen -W "NONE" ) \
                $( compgen -f -X "!*vim*" -- "$cur" ) )

    elif [[ "${cur}" == -* ]] ; then
        args='-t -q -c -S --cmd -A -b -C -d -D -e -E -f --nofork \
            -F -g -h -H -i -L -l -m -M -N -n -nb -o -R -r -s \
            -T -u -U -V -v -w -W -x -X -y -Y -Z --echo-wid \
            --help --literal --noplugin --version'
        args="${args} --echo-wid  --remote --remote-expr \
            --remote-send --remote-silent --remote-wait \
            --remote-wait-silent --serverlist \
            --servername --socketid"
        COMPREPLY=( $( compgen -W "${args}" -- $cur ) )
    else
        _filedir
    fi
}

complete -o filenames -F _gvim gvim evim eview gview gvimdiff rgvim rgview

# vim: set ft=sh sw=4 et sts=4 :