From e14070919343de50940800b8ff8172039b99fe3e Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Tue, 2 Jun 2015 14:11:16 +0200 Subject: [PATCH] [zsh]env for mmaret-geny --- .zsh/host:mmaret-geny/Environment.zsh | 3 +- .zsh/host:mmaret-geny/basic.zsh | 40 +++++++++++++++++++++++++++ .zsh/host:mmaret-geny/function.zsh | 20 ++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 .zsh/host:mmaret-geny/basic.zsh create mode 100644 .zsh/host:mmaret-geny/function.zsh diff --git a/.zsh/host:mmaret-geny/Environment.zsh b/.zsh/host:mmaret-geny/Environment.zsh index dde6ac2..ab82fc7 100755 --- a/.zsh/host:mmaret-geny/Environment.zsh +++ b/.zsh/host:mmaret-geny/Environment.zsh @@ -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 diff --git a/.zsh/host:mmaret-geny/basic.zsh b/.zsh/host:mmaret-geny/basic.zsh new file mode 100644 index 0000000..024923e --- /dev/null +++ b/.zsh/host:mmaret-geny/basic.zsh @@ -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 diff --git a/.zsh/host:mmaret-geny/function.zsh b/.zsh/host:mmaret-geny/function.zsh new file mode 100644 index 0000000..088e247 --- /dev/null +++ b/.zsh/host:mmaret-geny/function.zsh @@ -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 +}