Skip to content

Instantly share code, notes, and snippets.

@lccxx
Created April 30, 2017 01:12
Show Gist options
  • Save lccxx/f327216e01eb8ee2dec24717d9156ed8 to your computer and use it in GitHub Desktop.
Save lccxx/f327216e01eb8ee2dec24717d9156ed8 to your computer and use it in GitHub Desktop.
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/liuchong/.zshrc'
# End of lines added by compinstall
autoload -U compinit promptinit
compinit
promptinit
prompt walters
setopt autocd
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
export QT_QPA_PLATFORM=wayload
XDG_SESSION_TYPE=wanland exec dbus-run-session gnome-session
fi
setopt HIST_IGNORE_DUPS
autoload -Uz add-zsh-hook
function xterm_title_precmd () {
print -Pn '\e]2;%n@%m %/\a'
}
function xterm_title_preexec () {
print -Pn '\e]2;%n@%m %/ %# '
print -n "${(q)1}\a"
}
if [[ "$TERM" == (screen*|xterm*|rxvt*) ]]; then
add-zsh-hook -Uz precmd xterm_title_precmd
add-zsh-hook -Uz preexec xterm_title_preexec
fi
alias ll='ls -lFh --color=always'
alias tailf='tail -f'
alias less='less -R'
source ~/.zsh-nvm/zsh-nvm.plugin.zsh
export JAVA_HOME=/usr/lib/jvm/default
export ANDROID_HOME=$HOME/.opt/android-sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/ndk-bundle
export PATH=$PATH:$HOME/.opt/android-studio/bin/
export WINEPREFIX=$HOME/win32
export WINEARCH=win32
export DB_SOCKET="$HOME/work/mariadb/run/mariadb.socket"
autoload zkbd
function zkbd_file() {
[[ -f ~/.zkbd/${TERM}-${VENDOR}-${OSTYPE} ]] && printf '%s' ~/".zkbd/${TERM}-${VENDOR}-${OSTYPE}" && return 0
[[ -f ~/.zkbd/${TERM}-${DISPLAY} ]] && printf '%s' ~/".zkbd/${TERM}-${DISPLAY}" && return 0
return 1
}
[[ ! -d ~/.zkbd ]] && mkdir ~/.zkbd
keyfile=$(zkbd_file)
ret=$?
if [[ ${ret} -ne 0 ]]; then
zkbd
keyfile=$(zkbd_file)
ret=$?
fi
if [[ ${ret} -eq 0 ]] ; then
source "${keyfile}"
else
printf 'Failed to setup keys using zkbd.\n'
fi
unfunction zkbd_file; unset keyfile ret
# 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[Backspace]" ]] && bindkey -- "$key[Backspace]" backward-delete-char
[[ -n "$key[Delete]" ]] && bindkey -- "$key[Delete]" delete-char
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-history
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-history
[[ -n "$key[Left]" ]] && bindkey -- "$key[Left]" backward-char
[[ -n "$key[Right]" ]] && bindkey -- "$key[Right]" forward-char
fg() {
if [[ $# -eq 1 && $1 = - ]]; then
builtin fg %-
else
builtin fg %"$@"
fi
}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment