Skip to content

Instantly share code, notes, and snippets.

@nobucshirai
Created March 7, 2018 05:23
Show Gist options
  • Save nobucshirai/822f2ce971f3d144ac360033a386288f to your computer and use it in GitHub Desktop.
Save nobucshirai/822f2ce971f3d144ac360033a386288f to your computer and use it in GitHub Desktop.
# users generic .zshrc file for zsh(1)
# LANG
#
export LANG=ja_JP.UTF-8
case ${UID} in
0)
LANG=C
;;
esac
## Default shell configuration
#
# set prompt
#
autoload colors
colors
PROMPT='%n%# '
PROMPT="%{${fg[cyan]}%}$(echo `whoami`) #%{${reset_color}%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
#PROMPT="%n@%m%# "
PROMPT="%{${fg[green]}%}$(echo `whoami`)@%{${fg[green]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') #%{${reset_color}%}%b "
PROMPT=%(!."%{%}${PROMPT}".$PROMPT)
RPROMPT=[%~]
# auto change directory
#
setopt auto_cd
# auto directory pushd that you can get dirs list by cd -[tab]
#
setopt auto_pushd
# command correct edition before each completion attempt
#
setopt correct
# compacked complete list display
#
setopt list_packed
# no remove postfix slash of command line
#
setopt noautoremoveslash
# no beep sound when complete list displayed
#
setopt nolistbeep
## Keybind configuration
#
# emacs like keybind (e.x. Ctrl-a gets to line head and Ctrl-e gets
# to end) and something additions
#
bindkey -e
bindkey "^[[1~" beginning-of-line # Home gets to line head
bindkey "^[[4~" end-of-line # End gets to line end
bindkey "^[[3~" delete-char # Del
# historical backward/forward search with linehead string binded to ^P/^N
#
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
bindkey "\\ep" history-beginning-search-backward-end
bindkey "\\en" history-beginning-search-forward-end
# reverse menu completion binded to Shift-Tab
#
#bindkey "\e[Z" reverse-menu-complete
## Command history configuration
#
HISTFILE=${HOME}/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
## Completion configuration
#
fpath=(${HOME}/.zsh/functions/Completion ${fpath})
autoload -U compinit
compinit
## zsh editor
#
autoload zed
## Prediction configuration
#
#autoload predict-on
#predict-off
## Alias configuration
#
# expand aliases before completing
#
setopt complete_aliases # aliased ls needs if file/dir completions work
alias where="command -v"
alias j="jobs -l"
case "${OSTYPE}" in
freebsd*|darwin*)
alias ls="ls -G -w"
;;
linux*)
alias ls="ls --color=auto -F"
;;
esac
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
alias l1="ls -1"
alias du="du -h"
alias df="df -h"
alias su="su -l"
## terminal configuration
#
case "${TERM}" in
screen)
TERM=xterm
;;
esac
case "${TERM}" in
kterm*|xterm*)
export LSCOLORS=Fxfxchdxcxhghdabagacad
export LS_COLORS='di=35:ln=35:so=32:pi=33:ex=32:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors 'di=35' 'ln=35' 'so=32' 'ex=32' 'bd=46;34' 'cd=43;34'
;;
esac
# set terminal title including current directory
#
case "${TERM}" in
xterm|xterm-color|kterm|kterm-color)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment