Skip to content

Instantly share code, notes, and snippets.

@arusu0629
Last active March 30, 2020 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arusu0629/0ef3c5e70e815d248fff96ae26a46293 to your computer and use it in GitHub Desktop.
Save arusu0629/0ef3c5e70e815d248fff96ae26a46293 to your computer and use it in GitHub Desktop.
~/.zshrc
#!/bin/zsh
# Language
export LANG=ja_JP.UTF-8
# add PATH
PATH=/usr/local/bin:$PATH
# help how to use each commands
autoload -U compinit # supplement
compinit -u # well supplement
setopt autopushd # well "cd -"
setopt auto_list
setopt auto_menu
setopt list_packed
setopt auto_cd # auto change directory
# suppliment list size is 300
LISTMAX=300
# set emacs keybind
bindkey -e
# C-p , C-n -> predict change of commands
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^p" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
# prompt
autoload colors
colors
PROMPT="%{${fg[cyan]}%}[%n] %(!.#.$) %{${reset_color}%}"
PROMPT2="%{${fg[cyan]}%}%_> %{${reset_color}%}"
RPROMPT="%{${fg[green]}%}[%~]%{${reset_color}%}"
SPROMPT="%{${fg[yellow]}%}correct: %R -> %r [nyae]? %{${reset_color}%}"
export LSCOLORS=Exfxcxdxbxegedabagacad
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
# alias
alias ls="ls -G"
alias la="ls -a -G"
alias lf="ls -F -G"
alias ll="ls -l -G"
alias du="du -h"
alias df="df -h"
alias su="su -l"
alias say="say -v Alex"
# git branch prompt
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
zstyle ":vcs_info:git:*" unstaedstr "<U>"
zstyle ":vcs_info:git:*" stagedstr "<S>"
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
RPROMPT="%1(v|%F{yellow}%1v%f|) %F{green}[%~]%f"
# history
export HISTFILE=${HOME}/.zsh_history # refer to save place
export HISTSIZE=10000
export SAVEHIST=100000
setopt hist_ignore_dups # not repetition
setopt EXTENDED_HISTORY # save beginning and end
# Karabiner
alias karabiner="sudo killall karabiner_grabber && sudo killall karabiner_observer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment