Linda W wrote:
You would know, last minute cleanup I introduce a bug.
So lame...
Sorry, (had taken out a needed flag setting):
Here it is again (probably too many times for some)...*sigh*...
----
gvim.shh:
#!/bin/bash -u

#include stdalias
shopt -s expand_aliases
alias my=declare  string=declare
alias sub=function array='declare -a' int='declare -i'

sub gvim () {
 array orig_args=($@)  gv_files=() gv_ops=()
 int use_tab=0  look_for_ops=1

   sub _exec_gvim() {
     array args
     ((use_tab)) && args=("-p")
     (( ${#gv_ops[@]:-0} )) && args+=(${gv_ops[@]})
     (( $# )) && args+=($@)
     command gvim "${args[@]}"
     unset -f _exec_gvim
   }

 while (($#)); do
   my arg="$1" ; shift
   if ((look_for_ops)); then
     if [[ ${arg:0:1} == '-' ]] ; then
       arg=${arg:1}
       [[ $arg == '-' ]] && { look_for_ops=0; continue; }
       [[ $arg == 'p' ]] && { use_tab=1; continue; }
       gv_ops+=("-$arg");  continue;
     fi
   fi
   gv_files+=("$arg")
 done
 ((!${#gv_files[@]:-0})) && { _exec_gvim; return $? ; }
 if (( ${#gv_files[@]} == 1 )); then
   string path=${gv_files[0]}
   string pname=${path%.?(cc|h)}         # then get rid of
   if ((look_for_ops||use_tab)); then
     [[ -f $pname.cc && -f $pname.h ]] && {
       use_tab=1
       _exec_gvim "$pname".{cc,h} ; return $?; }
   fi
 fi
 command gvim "${orig_args[@]}"
}

export -f gvim
if alias gvim >& /dev/null; then
 # note -- need to figure out what to do if we find pre-existing alias
 # for now, issue warning/error
 #string _gvim_alias_=$(alias gvim)
 #galias=${_gvim_alias_#alias *=}
 #array gwords=(${galias//\'/})
 echo -e "\agvim is aliased; function will be ignored!!\a"
fi

# vim ts=2 sw=2



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to