Created
August 19, 2017 13:04
-
-
Save mohemohe/782603131be0b42402f59d01b4d55ca0 to your computer and use it in GitHub Desktop.
ArchLinuxのzshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INIT_VERBOSE=true | |
| INDICATOR_MESSAGE= | |
| INDICATOR_PID= | |
| function indicator() { | |
| trap "echo -en '\e[1A'; for ((i=0; i<`tput cols`; i++)); do { printf ' ' } done; kill $INDICATOR_PID &> /dev/null; exit 0" INT | |
| while [[ 0 ]] | |
| do { | |
| eval 'echo -e " ⠋ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⠙ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⠸ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⢰ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⣠ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⣄ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⡆ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| eval 'echo -e " ⠇ $INDICATOR_MESSAGE\e[1A"'; sleep 0.05; | |
| } done | |
| } | |
| function startIndicator() { | |
| if [[ -n "$1" ]]; then { | |
| INDICATOR_MESSAGE=$1 | |
| } fi | |
| set +m | |
| indicator & | |
| INDICATOR_PID=$! | |
| } | |
| function stopIndicator() { | |
| kill $INDICATOR_PID &> /dev/null | |
| wait | |
| set -m | |
| } | |
| function Z_VERBOSE_LOG() { | |
| if [[ "$INIT_VERBOSE" == "true" ]]; then { | |
| local tmp="[$1]" | |
| shift 1 | |
| tmp="$tmp $*" | |
| echo $tmp | |
| } fi | |
| } | |
| if [[ "$INIT_VERBOSE" == "false" ]]; then { | |
| startIndicator 'initializing zsh...' | |
| } else { | |
| set +m | |
| } fi | |
| export TERM=xterm-256color | |
| export ALL_PROXY=http://127.0.0.1:4080 | |
| export VAGRANT_DEFAULT_PROVIDER=lxc | |
| # ターミナルエミューレーター判定 並列化してはいけない | |
| __TERMINAL_EMULATOR=`basename "/"$(ps -f -p $(cat /proc/$(echo $$)/stat | cut -d \ -f 4) | tail -1 | sed 's/^.* //')` && Z_VERBOSE_LOG DONE "detect terminal emulator: ${__TERMINAL_EMULATOR=}" | |
| # macOSのパス初期化 並列化してはいけない | |
| [ -x /usr/libexec/path_helper ] && eval "$(/usr/libexec/path_helper -s)" && Z_VERBOSE_LOG DONE 'initialize path_helper' | |
| # 並列で初期化していいもの | |
| ( \ | |
| [ -f ~/.fzf.zsh ] && \ | |
| eval "$(source ~/.fzf.zsh)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize fzf' \ | |
| ) & ( \ | |
| [ -d ~/.rbenv ] && \ | |
| export PATH="${HOME}/.rbenv/bin:$PATH" && \ | |
| eval "$(rbenv init -)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize rbenv' \ | |
| ) & ( \ | |
| [ -d ~/.pyenv ] && \ | |
| export PATH="${HOME}/.pyenv/bin:$PATH" && \ | |
| eval "$(pyenv init -)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize pyenv' && \ | |
| [ -d ~/.pyenv/plugins/pyenv-virtualenv ] && \ | |
| eval "$(pyenv virtualenv-init -)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize pyenv-virtualenv' \ | |
| ) & ( \ | |
| [ -d ~/.yarn ] && \ | |
| eval "$(export PATH=$HOME/.yarn/bin:$PATH)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize yarn' \ | |
| ) & ( \ | |
| [ -f $LUNCHY_DIR/lunchy-completion.zsh ] && \ | |
| eval "$($LUNCHY_DIR/lunchy-completion.zsh)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize launchy' \ | |
| ) & ( \ | |
| [ -f '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc' ] && \ | |
| source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc' && \ | |
| Z_VERBOSE_LOG DONE 'initialize google-cloud-sdk (path)' \ | |
| ) & ( \ | |
| [ -f '/opt/google-cloud-sdk/path.zsh.inc' ] && \ | |
| source '/opt/google-cloud-sdk/path.zsh.inc' && \ | |
| Z_VERBOSE_LOG DONE 'initialize google-cloud-sdk (path)' \ | |
| ) & ( \ | |
| [ -f '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc' ] && \ | |
| source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc' && \ | |
| Z_VERBOSE_LOG DONE 'initialize google-cloud-sdk (completion)' \ | |
| ) & ( \ | |
| [ -f '/opt/google-cloud-sdk/completion.zsh.inc' ] && \ | |
| source '/opt/google-cloud-sdk/completion.zsh.inc' && \ | |
| Z_VERBOSE_LOG DONE 'initialize google-cloud-sdk (completion)' \ | |
| ) & ( \ | |
| command -v fasd &> /dev/null && \ | |
| [ "$?" -eq "0" ] && \ | |
| eval "$(fasd --init auto)" &> /dev/null && \ | |
| Z_VERBOSE_LOG DONE 'initialize fasd' \ | |
| ) & ( \ | |
| command -v thefuck &> /dev/null && \ | |
| [ "$?" -eq "0" ] && \ | |
| eval "$(thefuck --alias)" && \ | |
| Z_VERBOSE_LOG DONE 'initialize thefuck' \ | |
| ) & | |
| source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" && \ | |
| Z_VERBOSE_LOG DONE 'initialize prezto' && \ | |
| autoload -Uz promptinit && \ | |
| promptinit && \ | |
| prompt paradox && \ | |
| Z_VERBOSE_LOG DONE 'initialize prompt' | |
| export EDITOR=nvim | |
| export PATH=.:$HOME/.local/bin:/opt/bin:./node_modules/.bin:$PATH | |
| export XDG_CONFIG_HOME=$HOME/.config | |
| #export BYOBU_PREFIX=$(brew --prefix) | |
| #export HOMEBREW_GITHUB_API_TOKEN= | |
| export GOPATH=~/.go | |
| alias -g C='| cat' | |
| alias -g G='| grep' | |
| alias -g I='| iconv -f utf-8-mac -t utf-8' | |
| alias -g L='| less' | |
| alias -g S='2>&1 | post-slack' | |
| alias -g V='nvim -Ro' | |
| unalias bower | |
| alias cp='acp -g' | |
| alias cls='clear' | |
| alias csharpinit='yo csharp-cli-app' | |
| alias curl='ALL_PROXY= curl --ipv4 -L' | |
| alias explorer='ranger' | |
| alias ex='explorer' | |
| alias helpCPU='sudo bash -c "pkill -HUP powerd; killall quicklookd"' | |
| alias history='history -E 1' | |
| alias mv='amv -g' | |
| alias preztoconfig='nvim ~/.zpreztorc' | |
| unalias rsync | |
| unalias sl | |
| alias -g sl='sl; ls' | |
| alias serve-http='python2 -m SimpleHTTPServer' | |
| alias ssh="env TERM=xterm-256color ssh" | |
| alias sshconfgen="cat ~/.ssh/conf.d/*/*.sshconf >! ~/.ssh/config && bash -c 'sudo cp -f /Users/mohemohe/.ssh/config /var/root/.ssh/'" | |
| alias sync='sync;sync;sync' | |
| alias tmuxpowerlineconf='vim ~/.tmux/tmux-powerline/themes/default.sh' | |
| alias view='nvim -Ro' | |
| alias vi='vim' | |
| alias vim='nvim' | |
| alias vimconfig='nvim ${XDG_CONFIG_HOME}/nvim/init.vim' | |
| alias pbcopy='xsel --clipboard --input' | |
| alias zshconfig='nvim ~/.zshrc' | |
| alias zshreload='exec zsh' | |
| alias -s py='python' | |
| alias -s exe='mono' | |
| compdef sshmnt=ssh | |
| function precmd_prompt-iikanji() { | |
| if [[ $PROMPT == \(* ]]; then { | |
| export PROMPT=" | |
| virtualenv: ${PROMPT}" | |
| } fi | |
| } | |
| KONSOLE_PROFILE= | |
| function precmd_preexec_ssh-bg-color-change() { | |
| local CMD=${1} | |
| local NEXT_PROFILE= | |
| case "$CMD" in | |
| *ssh*prd* ) { | |
| NEXT_PROFILE=ArgonautRed | |
| } ;; | |
| *ssh*stg* ) { | |
| NEXT_PROFILE=ArgonautPurple | |
| } ;; | |
| *ssh*dev* ) { | |
| NEXT_PROFILE=ArgonautGreen | |
| } ;; | |
| *ssh*spnlive* ) { | |
| NEXT_PROFILE=ArgonautGreen | |
| } ;; | |
| *ssh*home* ) { | |
| NEXT_PROFILE=ArgonautBlue | |
| } ;; | |
| esac | |
| if [[ "$NEXT_PROFILE" == "" ]]; then { | |
| NEXT_PROFILE=Argonaut | |
| } fi | |
| if [[ ! "$KONSOLE_PROFILE" == "$NEXT_PROFILE" ]]; then { | |
| KONSOLE_PROFILE=$NEXT_PROFILE | |
| if [[ "${__TERMINAL_EMULATOR}" == "konsole" ]]; then { | |
| konsoleprofile colors=$NEXT_PROFILE | |
| } fi | |
| } fi | |
| } | |
| autoload -Uz add-zsh-hook | |
| add-zsh-hook precmd precmd_prompt-iikanji | |
| add-zsh-hook precmd precmd_preexec_ssh-bg-color-change | |
| add-zsh-hook preexec precmd_preexec_ssh-bg-color-change | |
| function dict() { | |
| grep "$1" /opt/gene95/gene.utf.txt -E -A 1 -wi --color | |
| } | |
| stopIndicator | |
| wait | |
| set -m | |
| #neofetch | |
| # reset | |
| echo . > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment