[zsh]env for mmaret-geny

This commit is contained in:
Mathieu Maret 2015-06-02 14:11:16 +02:00 committed by Mathieu Maret
parent 69661c6a8f
commit e140709193
3 changed files with 61 additions and 2 deletions

View File

@ -9,5 +9,4 @@ export DEBEMAIL=mmaret@genymobile.com
export DEBFULLNAME=Mathieu Maret
export PATH=:$JAVA_HOME/bin/:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/build-tools/android-4.2.2:$NDK_HOME:$GENYMOTION_HOME:$PATH:$MY_PROJECT_TOOLCHAIN
source /etc/profile.d/vte.sh

View File

@ -0,0 +1,40 @@
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-search-backward
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-search-forward
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () {
printf '%s' "${terminfo[smkx]}"
}
function zle-line-finish () {
printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init
zle -N zle-line-finish
fi

View File

@ -0,0 +1,20 @@
lollidocker (){
if [ -n "$SSH_AUTH_SOCK" ]; then
SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
fi
AOSP_ARGS=${AOSP_ARGS:--it}
img=$(docker ps | grep lollipop | awk '{print $1}');
if [ -z $img ]; then
img=$(docker ps -a | grep lollipop | awk '{print $1}') | head -1;
if [ -z $img ]; then
echo "Running a new container"
echo "docker run $AOSP_ARGS $SSH_AUTH_ARGS -v /home/mmaret/Project:/aosp/Project -i -t lollipop"
else
echo "Starting $img"
docker start -i -a $img
fi
else
echo "Attach to $img"
docker exec -it $img /bin/bash
fi
}