Skip to content

Instantly share code, notes, and snippets.

@jun76
Created July 2, 2017 02:28
Show Gist options
  • Select an option

  • Save jun76/be473bb0f79c072a2ccbd3fa8c512cfe to your computer and use it in GitHub Desktop.

Select an option

Save jun76/be473bb0f79c072a2ccbd3fa8c512cfe to your computer and use it in GitHub Desktop.
# autoload
autoload -U compinit
autoload colors
autoload history-search-end
# exec functions
compinit -u
colors
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
# export
export LANG=ja_JP.UTF-8
export LS_COLORS='di=01;34:ln=01;36:ex=01;32:*.tar=01;31:*.gz=01;31'
# setopt
setopt prompt_subst
setopt transient_rprompt
setopt auto_cd
setopt auto_pushd
setopt list_packed
setopt noautoremoveslash
setopt nolistbeep
setopt extended_history
setopt hist_ignore_dups
setopt hist_ignore_space
setopt inc_append_history
setopt share_history
setopt no_flow_control
setopt auto_param_slash
setopt mark_dirs
setopt list_types
setopt auto_menu
setopt auto_param_keys
setopt always_last_prompt
setopt complete_in_word
setopt glob_complete
setopt hist_expand
setopt numeric_glob_sort
setopt magic_equal_subst
setopt extended_glob
setopt complete_aliases
# bindkey
bindkey -e
bindkey "^p" history-beginning-search-backward-end
bindkey "^n" history-beginning-search-forward-end
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^S' history-incremental-pattern-search-forward
# zstyle for completion
zstyle ':completion:*:default' \
menu select=2
zstyle ':completion:*:messages' \
format '%B%F{yellow}%d%f%b'$DEFAULT
zstyle ':completion:*:warnings' \
format '%B%F{red}No matches for: %f%b''%B%F{yellow}%d%f%b'$DEFAULT
zstyle ':completion:*:corrections' \
format '%B%F{yellow}%d%f %F{red}(errors: %e)%f%b'$DEFAULT
zstyle ':completion:*:descriptions' \
format '%F{yellow}%BCompleting %d:%b%f'$DEFAULT
zstyle ':completion:*:options' \
description 'yes'
zstyle ':completion:*' \
group-name ''
zstyle ':completion:*:*files' \
ignored-patterns '*?.o' '*?~'
zstyle ':completion:*' \
list-separator '-->'
zstyle ':completion:*:manuals' \
separate-sections true
zstyle ':completion:*:*:-subscript-:*' \
tag-order indexes parameters
zstyle ':completion:*:default' \
list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' \
matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' \
completer _oldlist _complete _match _ignored _approximate _prefix
zstyle ':completion:*' \
use-cache yes
zstyle ':completion:*' \
verbose yes
# depend on OS
case "${OSTYPE}" in
freebsd*|darwin*)
alias ls="ls -G -w"
;;
linux*)
alias ls="ls --color"
;;
esac
# alias
cd_with_ls()
{
cd $1 && ls
}
alias cd='cd_with_ls'
alias rmtil='rm *~ && ls'
# other settings
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=$HISTSIZE
# %n: user, %m: host, %?: exit state, %~: cd
# %F{XXX}OOO%f: echo OOO with color XXX
# %BXXX%b: echo XXX with bold
PROMPT=$'\n%B%F{green}%n%f%b%B%F{blue}@%f%b%B%F{green}%m%f%b (%?) : %B%F{yellow}%~%f%b'$'\n> '
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] && PROMPT="%{${fg[white]}%}${HOST%%.*} ${PROMPT}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment