zsh-users
 help / color / mirror / code / Atom feed
* script help
@ 2012-12-08 11:15 shawn wilson
  2012-12-08 15:09 ` Aaron Schrab
  0 siblings, 1 reply; 4+ messages in thread
From: shawn wilson @ 2012-12-08 11:15 UTC (permalink / raw)
  To: Zsh Users

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
}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-08 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-08 11:15 script help shawn wilson
2012-12-08 15:09 ` Aaron Schrab
2012-12-08 15:43   ` shawn wilson
2012-12-08 17:07     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).