Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
function to run vim
- X-seq: zsh-users 18142
- From: shawn wilson <ag4ve.us@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: function to run vim
- Date: Wed, 13 Nov 2013 06:18:57 -0500
- 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==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author