Skip to content

Instantly share code, notes, and snippets.

@573
Created May 6, 2010 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 573/392670 to your computer and use it in GitHub Desktop.
Save 573/392670 to your computer and use it in GitHub Desktop.
my zshenv.local functions for zsh running with cygwin
# my zshenv.local functions
# ZSH_VERSION == 4.3.9
# ~/.zshenv.local [U1]
# sourced by ~/.zshenv
if [ -n ${functions[loadmsg]} ] ; then
loadmsg "~/.zshenv.local"
else
loadmsg() { echo "\e[1;32m$1\e[0m" }
loadmsg "~/.zshenv.local"
fi
# For running from arbitrary drive letter, windows-specific, e. g.
# run the shell with ASuite (http://www.salvadorsoftware.com/software/asuite):
# $Asuite\..\zsh\bin\mintty.exe --hold=error /usr/bin/env __APPS="$ASuite/.." PROGRAMFILES="d:/programme" HOME=$ASuite/../.homedir /usr/bin/zsh
HOME=$(/usr/bin/cygpath -u $HOME)
__APPS=$(/usr/bin/cygpath -u $__APPS)
PROGRAMFILES=$(/usr/bin/cygpath -u $PROGRAMFILES)
EDITOR="${__APPS}/optimize/sc2.exe"
typeset EDITOR
export EDITOR
INFO_PRINT_COMMAND='>/tmp/infonode.txt'
typeset INFO_PRINT_COMMAND
export INFO_PRINT_COMMAND
PAGER='/usr/bin/less -r'
typeset PAGER
export PAGER
SCALA_HOME="$(/usr/bin/cygpath -m E:/test/Nn/scala-2.8.0.r18634-b20090902020144)"
typeset SCALA_HOME
export SCALA_HOME
tpath=(
"$path[@]"
)
path=(
$path
/usr/bin
/usr/local/bin
# /usr/lib/git-core is for the git-completion
/usr/lib/git-core
)
# only unique entries please.
typeset -U path
export PATH
makepdf()
{(
setopt rc_expand_param glob_subst
path=(
$(/usr/bin/cygpath -u "${__APPS}/miktex-2.8/miktex/bin")
"$HOME/bin/$(/usr/bin/uname -m)-$(/usr/bin/uname -o)"
"$PATH"
)
builtin noglob texify --language=latex --pdf --tex-option="-shell-escape -enable-pipes" $*
)}
gvim() # TODO make two aliases referring to this function, give this function a fixed parameter (win32|unix) to switch between differently targeted gvim instances.
{(
setopt rc_expand_param glob_subst
path=(
$(/usr/bin/cygpath -u "${__APPS}/gVimPortable/App/vim/vim72")
"$PATH"
)
# SHELL=$(/usr/bin/cygpath -sm "${COMSPEC}")
builtin noglob /usr/bin/env -i /usr/bin/env HOME=${HOME} PATH=${PATH} gvim.exe -p --remote-tab-silent $* &
)}
gcc4-env()
{(
setopt rc_expand_param glob_subst
export INFOPATH=$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/info"):
path=(
$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/libexec/gcc/mingw32/4.4.0")
$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/bin")
# "$PATH" mentioning not needed here, but e. g. for /usr/bin/rlwrap
)
noglob /usr/bin/env -i /usr/bin/env USERPROFILE=${USERPROFILE} HOME=${HOME} __APPS=${__APPS} PATH=${PATH} TERM=${TERM} /usr/bin/zsh $*
)}
ghc-pkg()
{(
setopt rc_expand_param glob_subst
path=(
# Using gcc4 is experimental, comment first if problems occur
$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/libexec/gcc/mingw32/4.4.0")
$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/bin")
"$HOME/Anwendungsdaten/cabal/bin"
$(/usr/bin/cygpath -u $(/usr/bin/cygpath -m $(/usr/bin/cygpath -sm "${PROGRAMFILES}/haskell platform/2009.2.0.2/bin")))
$(/usr/bin/cygpath -u $(/usr/bin/cygpath -m $(/usr/bin/cygpath -sm "${PROGRAMFILES}/haskell platform/2009.2.0.2/extralibs/bin")))
"$HOME/bin/$(/usr/bin/uname -m)-$(/usr/bin/uname -o)"
# For gtk2hs, must be the only gtk on path
$(/usr/bin/cygpath -u "${__APPS}/gtk/bin")
"$PATH"
)
declare GHC_PACKAGE_PATH=$(/bin/cygpath -w $HOME/Anwendungsdaten/ghc/i386-mingw32-$(/usr/bin/env ghc --numeric-version | /usr/bin/sed 's/$//')/package.conf)\;
builtin noglob /usr/bin/env -i /usr/bin/env HOME=$(/usr/bin/cygpath -m $HOME) APPDATA=$(/usr/bin/cygpath -w $HOME/Anwendungsdaten) USERPROFILE=$(/usr/bin/cygpath -w $HOME) COMSPEC=${COMSPEC} HISTSIZE=${HISTSIZE} SAVEHIST=${SAVEHIST} TEMP=${TEMP} TMP=${TMP} PAGER=${PAGER} TERM=${TERM} PATH=${PATH} ghc-pkg --package-conf ${GHC_PACKAGE_PATH/\;/} $*
)}
ghci()
{(
setopt rc_expand_param glob_subst
path=(
# Using gcc4 is experimental, comment first if problems occur
$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/libexec/gcc/mingw32/4.4.0")
$(/usr/bin/cygpath -u "${__APPS}/mingw-gcc4/bin")
"$HOME/Anwendungsdaten/cabal/bin"
$(/usr/bin/cygpath -u $(/usr/bin/cygpath -m $(/usr/bin/cygpath -sm "${PROGRAMFILES}/haskell platform/2009.2.0.2/bin")))
$(/usr/bin/cygpath -u $(/usr/bin/cygpath -m $(/usr/bin/cygpath -sm "${PROGRAMFILES}/haskell platform/2009.2.0.2/extralibs/bin")))
"$HOME/bin/$(/usr/bin/uname -m)-$(/usr/bin/uname -o)"
# For gtk2hs, must be the only gtk on path
$(/usr/bin/cygpath -u "${__APPS}/gtk/bin")
"$PATH"
)
declare GHC_PACKAGE_PATH=$(/bin/cygpath -w $HOME/Anwendungsdaten/ghc/i386-mingw32-$(/usr/bin/env ghc --numeric-version | /usr/bin/sed 's/$//')/package.conf)\;
# ghc[i] is win32 native, so we need to derive COMSPEC and all PATH entries (see "$PATH" above), the HOME etc. paths need to be windows-like. TERM variable is needed inside ghci session, to enable better command line handling, I have TERM=xterm
builtin noglob /usr/bin/env -i /usr/bin/env HOME=$(/usr/bin/cygpath -m $HOME) APPDATA=$(/usr/bin/cygpath -w $HOME/Anwendungsdaten) USERPROFILE=$(/usr/bin/cygpath -w $HOME) COMSPEC=${COMSPEC} HISTSIZE=${HISTSIZE} SAVEHIST=${SAVEHIST} TEMP=${TEMP} TMP=${TMP} PAGER=${PAGER} TERM=${TERM} PATH=${PATH} /usr/bin/rlwrap -s 2000 $(/usr/bin/which ghcii.sh) -package-conf ${GHC_PACKAGE_PATH/\;/} -read-dot-ghci $*
)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment