Skip to content

Instantly share code, notes, and snippets.

@zinntikumugai
Created February 12, 2021 06:18
Show Gist options
  • Save zinntikumugai/9776059c41c4d4866de7dcace7744afe to your computer and use it in GitHub Desktop.
Save zinntikumugai/9776059c41c4d4866de7dcace7744afe to your computer and use it in GitHub Desktop.
# homebrew
# バックアップ変数に保存されていなければ待避、あればPATHを上書き
if [ ${BREW_BK_PATH:-default} = "default" ]; then
export BREW_BK_PATH=$PATH
else
export PATH=$BREW_BK_PATH
fi
# アーキテクチャに応じてhomebrewのパス変更
if [ `uname -m` = "arm64" ]; then
export PATH=/opt/homebrew/bin:$PATH
export PATH=/bin:$PATH
else
export PATH=/usr/local/bin/brew:$PATH
fi
# zsh settings
setopt hist_ignore_dups
setopt hist_ignore_all_dups
# 履歴共有
setopt share_history
# alias 実行時でも補完する
setopt complete_aliases
## brew active plugins
# -e: file exists, -d: direcotry exists
if type brew &>/dev/null; then
## git
if [ -e "$(brew --prefix)/bin/git" ]; then
export PATH=$(brew --prefix)/bin/git:$PATH
fi
# zsh plugins
if [ -d "$(brew --prefix)/share/zsh-completions" ];then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
fi
autoload -Uz compinit
compinit
## zsh autosuggesions
if [ -e $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
## zsh syntax highlighting
if [ -e $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
fi
# alias ls
alias ll='ls -l'
# シェルプロント変更
export PROMPT="%n@%m(`uname -m`) %~ %# "
# NVM
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