From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23153 invoked by alias); 13 Nov 2013 11:19:36 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18142 Received: (qmail 11504 invoked from network); 13 Nov 2013 11:19:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=B0mB1O0hZHJi40+1uivLoSct1v9JSLiVsFgjPYegots=; b=lwKxh/cS9aUxwmmzPVZBarFwNyVZvb1ZJJvViI//WbRUKBToXov7Fx+dBjuT8LB07n +XC/KrMs4aVYz2yQV9N6jvms/Qar2XtdNsDb/lKgMELHDduKxrUXsgywRf08p1BVuey7 z3MpZXo8hO6Op+BG9Up01VlTjX8ygNzKMgOymfrq+zHKHAIuMsPWzUO0sqTuuQ9oZAMS I6WgIVU75E2fsskDguoZVyd+3eCQWTFPj5vagioPavy21kBaE9OKDKm6uA5gq9m42eYh rbGPu/vdy5a073hjfDCEKxmFDpmJ7zXfyWyLPsSnanJWgn5El6/LjrrfLkaRh70vI7Ur l6cQ== X-Received: by 10.58.180.227 with SMTP id dr3mr364625vec.36.1384341557446; Wed, 13 Nov 2013 03:19:17 -0800 (PST) MIME-Version: 1.0 From: shawn wilson Date: Wed, 13 Nov 2013 06:18:57 -0500 Message-ID: Subject: function to run vim To: Zsh Users Content-Type: text/plain; charset=UTF-8 A while I made a function so that I could keep one vim session (gvim really) and that running 'vim file' would open the file in a new tab in that session. Recently, it has stopped working.and I'm not sure why. I get this: vim --servername SWILSON --remote-tab file vimfunc:71: command not found: vim --servername SWILSON --remote-tab file which is just ${=cmd} which should run the command? vimfunc () { local cmd local servername local remote local misc local version local username=$(echo $USER | tr "[:lower:]" "[:upper:]") local opt_ex="^-" while [ $# -gt 0 ] ; do case "$1" in --servername) if [[ $2 =~ $opt_ex ]] ; then echo "Servername option without a parameter. Doing nothing." return else servername="$2" shift fi ;; --remote*) if [ -z $remote ] ; then if [[ $2 =~ $opt_ex ]] ; then remote="$1" else remote="$1 $2" shift fi 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 ;; --version*) version="1" ;; *) misc="$misc $1" ;; esac shift done cmd="vim" if [ ! -z $servername ] ; then cmd="$cmd --servername $servername" else cmd="$cmd --servername $username" fi if [ -z $misc ] && [ -z $remote ] ; then # list version if we asked for that if [ ! -z version ] ; then cmd="$cmd --version" fi ${=cmd} return fi if [ ! -z $remote ] ; then cmd="$cmd $remote $misc" else cmd="$cmd --remote-tab $misc" fi echo $cmd ${=cmd} return }