From 6af03b925da1e2cf5549ff78e411c9b044930ca3 Mon Sep 17 00:00:00 2001 From: Taeyeon Mori Date: Sun, 28 May 2017 01:41:31 +0900 Subject: [PATCH] zsh: Add some Termux stuff --- zsh/zpreztorc | 3 +-- zsh/zprofile | 40 ++++++++++++++++++++++++++++++---------- zsh/zshrc | 26 ++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/zsh/zpreztorc b/zsh/zpreztorc index 8525495..07d4acf 100644 --- a/zsh/zpreztorc +++ b/zsh/zpreztorc @@ -32,7 +32,6 @@ zstyle ':prezto:load' pmodule \ 'spectrum' \ 'utility' \ 'completion' \ - 'prompt' \ 'syntax-highlighting' \ 'git' \ 'pacman' \ @@ -91,7 +90,7 @@ zstyle ':prezto:module:editor' dot-expansion 'yes' # Set the prompt theme to load. # Setting it to 'random' loads a random theme. # Auto set to 'off' on dumb terminals. -zstyle ':prezto:module:prompt' theme "tae" +#zstyle ':prezto:module:prompt' theme "tae" # # Ruby diff --git a/zsh/zprofile b/zsh/zprofile index c7730bb..7dd145b 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -1,4 +1,4 @@ -# vim: ft=sh +# vim: ft=zsh # # Executes commands in every top-level shell # @@ -25,17 +25,18 @@ # # Browser # - if [[ "$OSTYPE" == darwin* ]]; then export BROWSER=open +elif (( $+commands[termux-open] )); then + export BROWSER=termux-open elif (( $+commands[xdg-open] )); then export BROWSER=xdg-open fi + # # Editors # - if (( $+commands[nvim] )); then export EDITOR=nvim export VISUAL=nvim @@ -46,14 +47,35 @@ fi export PAGER='less' + # # Language # - if [[ -z "$LANG" ]]; then export LANG='en_US.UTF-8' fi + +# +# Termux +# +if (( $+commands[termux-info] )); then + export TMPDIR="$PREFIX/tmp" +fi + + +# +# Terminfo +# +if [[ ! -f "${PREFIX:-/usr}/share/terminfo/${TERM:0:1}/$TERM" ]]; then + if [[ "${TERM:0:7}" == "konsole" ]] || echo $TERM | grep -q 256color; then + export TERM=xterm-256color + else + export TERM=xterm + fi +fi + + # # Paths # @@ -99,10 +121,10 @@ if (( $+commands[lesspipe.sh] )); then export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' fi + # # Temporary Files # - if [[ ! -d "$TMPDIR" ]]; then export TMPDIR="/tmp/$UID" mkdir -p -m 700 "$TMPDIR" @@ -117,7 +139,6 @@ fi # # SSH # - if (( $+commands[systemctl] )); then eval "$(systemctl --user show-environment | grep '^SSH_AUTH_SOCK=')" fi @@ -130,20 +151,19 @@ export SSH_AUTH_SOCK # # Arch Build system # - -export ASPROOT=$HOME/aur/ABS/.asp +if [ -f /etc/arch-release ]; then + export ASPROOT=$HOME/aur/ABS/.asp +fi # # LaTeX # - export TEXMFHOME=$DOTFILES/texmf # # Local overrides # - [[ -e "$DOTFILES/zsh/zprofile.local" ]] && source "$DOTFILES/zsh/zprofile.local" diff --git a/zsh/zshrc b/zsh/zshrc index a68fa25..879f3b6 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -13,11 +13,14 @@ fpath=( typeset -gU fpath + # # Use zplug # - export ZPLUG_HOME=$DOTFILES/zsh/zplug +if (( $+commands[termux-info] )); then + rm $ZPLUG_HOME/zcompdump # Broken in Termux +fi if [[ -s "$ZPLUG_HOME/init.zsh" ]]; then source "$ZPLUG_HOME/init.zsh" @@ -62,22 +65,37 @@ function gupf { # # rsync # - alias rsync="rsync -aXzPvihs -e ssh" # # NeoVim # - if (( $+commands[nvim] )); then alias vim=nvim fi # -# Local overrides +# BusyBox # +# Kill fancy aliases on BusyBox, since not all GNU options are supported +if (( $+commands[busybox] )); then + for cmd in `busybox --list`; do + if (( $+aliases[$cmd] )); then + __whence="`builtin whence -p $cmd`" + if [ -L "$__whence" ] && command readlink "$__whence" | command grep -q busybox; then + unalias $cmd + fi + fi + unset __whence + done +fi + + +# +# Local overrides +# [[ -e "$DOTFILES/zsh/zshrc.local" ]] && source "$DOTFILES/zsh/zshrc.local"