Skip to content

Instantly share code, notes, and snippets.

@misodengaku
Last active November 30, 2017 01:15
Show Gist options
  • Save misodengaku/8260de3f9c4cadce252f to your computer and use it in GitHub Desktop.
Save misodengaku/8260de3f9c4cadce252f to your computer and use it in GitHub Desktop.
zshrc
# 神 https://gist.github.com/teshi04/6132532
# env
export TERM='xterm'
export LSCOLORS=exfxcxdxbxegedabagacad
export LANG=ja_JP.UTF-8
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
alias ls="ls --color"
alias ll="ls -lh"
alias la="ls -lha"
alias free="free -h"
alias df="df -h"
alias msfconsole="msfconsole -L"
alias aria2c="aria2c -x10"
# pip install Pygments
alias ccat='pygmentize -O style=monokai -f console256 -g'
# 補完機能
autoload -U compinit
compinit -u
# 移動したディレクトリを記録・・・cd-[Tab]で移動履歴一覧
setopt auto_pushd
# コマンド訂正
setopt correct
#補完候補を詰めて表示
setopt list_packed
# lsの配色と補完候補の配色を合わせる
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=32' 'bd=46;34' 'cd=43;34'
# 大文字小文字の区別をせずに補完
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# tab補完で選択できるようにする
zstyle ':completion:*:default' menu select
# set terminal title including current directory
case "${TERM}" in
kterm*|xterm*)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
export LSCOLORS=exfxcxdxbxegedabagacad
export
LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
;;
esac
# プロンプトの設定
autoload colors
colors
case ${UID} in
0)
PROMPT="[%{${fg[green]}%}%n@%m%{${reset_color}%}]
%{${fg[green]}%}#%{${reset_color}%} "
PROMPT2="%B%{${fg[green]}%}%_#%{${reset_color}%}%b "
SPROMPT="%B%{${fg[blue]}%}%r is correct?
[n,y,a,e]:%{${reset_color}%}%b "
RPROMPT="%{${fg[green]}%}[%~]%{${reset_color}%}"
;;
*)
PROMPT="[%n@%m] %{${fg[green]}%}#%{${reset_color}%} "
PROMPT2="%B%{${fg[green]}%}%_#%{${reset_color}%}%b "
SPROMPT="%B%{${fg[blue]}%}%r is correct?
[n,y,a,e]:%{${reset_color}%}%b "
RPROMPT="%{${fg[green]}%}[%~]%{${reset_color}%}"
;;
esac
#コマンド履歴
HISTFILE=~/.zsh_history
HISTSIZE=6000000
SAVEHIST=6000000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
#コマンド履歴検索
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
#ログイン時にtmuxを自動起動
#if [ -z "$TMUX" -a -z "$STY" ]; then
# if type tmuxx >/dev/null 2>&1; then
# tmuxx
# elif type tmux >/dev/null 2>&1; then
# if tmux has-session && tmux list-sessions | /usr/bin/grep -qE
#'.*]$'; then
# tmux attach && echo "tmux attached session "
# else
# tmux new-session && echo "tmux created new session"
# fi
# fi
#fi
# Home/End/Delete key
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[[3~" delete-char
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment