zsh-users
 help / color / mirror / code / Atom feed
From: shawn wilson <ag4ve.us@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: script help
Date: Sat, 8 Dec 2012 06:15:15 -0500	[thread overview]
Message-ID: <CAH_OBidxmYPtmxrmwMYyE2U9tytbiwC7AtKpNJ7va3oDG8p66Q@mail.gmail.com> (raw)

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
}


             reply	other threads:[~2012-12-08 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08 11:15 shawn wilson [this message]
2012-12-08 15:09 ` Aaron Schrab
2012-12-08 15:43   ` shawn wilson
2012-12-08 17:07     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH_OBidxmYPtmxrmwMYyE2U9tytbiwC7AtKpNJ7va3oDG8p66Q@mail.gmail.com \
    --to=ag4ve.us@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).