Skip to content

Instantly share code, notes, and snippets.

@dais0n
Last active March 17, 2018 03:49
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 dais0n/0e865dd54932b9ff4ab1de40200db717 to your computer and use it in GitHub Desktop.
Save dais0n/0e865dd54932b9ff4ab1de40200db717 to your computer and use it in GitHub Desktop.
zsh_like_fish
# --------------
# general
# --------------
# locale
export LANG='ja_JP.UTF-8'
export LC_ALL='ja_JP.UTF-8'
#prompt
autoload -U promptinit
autoload -U colors && colors
# vcs
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
_vcs_precmd () { vcs_info }
autoload -Uz add-zsh-hook
add-zsh-hook precmd _vcs_precmd
# prompt colors(black, red, green, yellow, blue, magenda, cyan, white)
PROMPT='%{${fg[yellow]}%}%~%{${reset_color}%}
%{${fg[green]}%}[%m@%n]%{${reset_color}%}%{${fg[blue]}%}$vcs_info_msg_0_%{${reset_color}%}$ '
# path
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# less env
export LESS='-i -M -R'
# cdr
setopt pushd_ignore_dups
setopt AUTO_PUSHD
DIRSTACKSIZE=100
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
# emacs keybind
bindkey -e
# autocd
setopt auto_cd
# --------------
# plugin
# --------------
if [ ! -e "${HOME}/.zplug/init.zsh" ]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh| zsh
fi
source ${HOME}/.zplug/init.zsh
# install plugins
zplug 'zsh-users/zsh-syntax-highlighting'
zplug 'zsh-users/zsh-autosuggestions'
zplug "peco/peco", as:command, from:gh-r
zplug "mollifier/anyframe"
# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
zplug load --verbose
# plugin settings
zstyle ":anyframe:selector:" use peco
bindkey '^Z' anyframe-widget-cdr
bindkey '^R' anyframe-widget-put-history
bindkey '^Y' vi-forward-word
# --------------
# completion
# --------------
autoload -Uz compinit && compinit
# sudo
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
# --------------
# history
# --------------
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt extended_history
setopt hist_ignore_dups
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_verify
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt hist_expand
setopt inc_append_history
# --------------
# alias
# --------------
alias ls='ls -G'
alias ll='ls -lah'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'
alias vi='vim'
alias rmi='rm -i'
# ▼ global alias
alias -g G='| grep'
alias -g L='| less'
# --------------
# path
# --------------
# go path
export GOPATH="${HOME}/go"
if [ -e "${GOPATH}" ]; then
export PATH=${GOPATH}/bin:$PATH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment