Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

script help



this is in my .zshrc file and it fails to execute $cmd with:
vim:45: no such file or directory: /usr/local/bin/vim --servername SWILSON

######## zshrc part:
# make vim use or initialize a session with a new tab unless...
vim () {
    local cmd
    local servername
    local remote

    local username=$(echo $USER | tr "[:lower:]" "[:upper:]")

    local opt_ex="^-"

    while [ $# -gt 0 ] ; do
        case "$1" in
            --servername)
                if [[ $1 =~ $opt_ex ]] ; then
                    echo "Servername option without a parameter. Doing nothing."
                    return
                else
                    servername="$2"
                    return
                fi
                ;;
            --remote*)
                if [ -z $remote ] ; then
                    remote=$1
                else
                    # I'll deal with this properly if it is reasonable
to take multiple --remote* things
                    echo "Should not call two remote options at once.
Doing nothing."
                    return
                fi
                ;;
            *)
                misc="$misc $1"
                ;;
        esac
        shift
    done

    cmd="/usr/local/bin/vim"

    if [ ! -z $servername ] ; then
        cmd="$cmd --servername $servername"
    else
        cmd="$cmd --servername $username"
    fi

    if [ -z $misc ] && [ -z $remote ] ; then
        $cmd
        return
    fi

    if [ ! -z $remote ] ; then
        cmd="$cmd $remote $misc"
    else
        cmd="$cmd --remote-tab $misc"
    fi

    $cmd
    return
}



Messages sorted by: Reverse Date, Date, Thread, Author