Guest User

Untitled

a guest
Jan 20th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. # 色を使用
  2. autoload -Uz colors
  3. colors
  4.  
  5. # 補完
  6. autoload -Uz compinit
  7. compinit
  8.  
  9. # emacsキーバインド
  10. #bindkey -e
  11.  
  12. # viキーバインド
  13. bindkey -v
  14.  
  15. # 他のターミナルとヒストリーを共有
  16. setopt share_history
  17.  
  18. # ヒストリーに重複を表示しない
  19. setopt histignorealldups
  20.  
  21. HISTFILE=~/.zsh_history
  22. HISTSIZE=10000
  23. SAVEHIST=10000
  24.  
  25. # cdコマンドを省略して、ディレクトリ名のみの入力で移動
  26. setopt auto_cd
  27.  
  28. # 自動でpushdを実行
  29. setopt auto_pushd
  30.  
  31. # pushdから重複を削除
  32. setopt pushd_ignore_dups
  33.  
  34. # コマンドミスを修正
  35. setopt correct
  36.  
  37. # エイリアス
  38. alias ls='ls -hGF'
  39. alias lst='ls -ltr'
  40. alias la='ls -la'
  41. alias ll='ls -l'
  42. alias vi='vim'
  43. alias vz='vim ~/.zshrc'
  44.  
  45. # historyに日付を表示
  46. alias h='fc -lt '%F %T' 1'
  47. alias mkdir='mkdir -p'
  48. alias ..='c ../'
  49. alias back='pushd'
  50. alias diff='diff -U1'
  51.  
  52. # backspace,deleteキーを使えるように
  53. stty erase ^H
  54. bindkey "^[[3~" delete-char
  55.  
  56. # cdの後にlsを実行
  57. chpwd() { ls -lhGF }
  58.  
  59. # どこからでも参照できるディレクトリパス
  60. cdpath=(~)
  61.  
  62. # 区切り文字の設定
  63. autoload -Uz select-word-style
  64. select-word-style default
  65. zstyle ':zle:*' word-chars "_-./;@"
  66. zstyle ':zle:*' word-style unspecified
  67.  
  68. # Ctrl+sのロック, Ctrl+qのロック解除を無効にする
  69. setopt no_flow_control
  70.  
  71. # プロンプトを2行で表示、時刻を表示
  72. #PROMPT="%(?.%{${fg[green]}%}.%{${fg[red]}%})%n${reset_color}@${fg[blue]}%m${reset_color}(%*%) %~
  73. #%# "
  74. PROMPT='[%F{magenta}%B%n%b%f@%F{blue}%U%m%u%f]# '
  75. RPROMPT='[%F{3}%d%f]'
  76.  
  77. # 補完後、メニュー選択モードになり左右キーで移動が出来る
  78. zstyle ':completion:*:default' menu select=2
  79.  
  80. # 補完で大文字にもマッチ
  81. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  82.  
  83. # Ctrl+rでヒストリーのインクリメンタルサーチ、Ctrl+sで逆順
  84. bindkey '^r' history-incremental-pattern-search-backward
  85. bindkey '^s' history-incremental-pattern-search-forward
  86.  
  87. # コマンドを途中まで入力後、historyから絞り込み
  88. # 例 ls まで打ってCtrl+pでlsコマンドをさかのぼる、Ctrl+bで逆順
  89. autoload -Uz history-search-end
  90. zle -N history-beginning-search-backward-end history-search-end
  91. zle -N history-beginning-search-forward-end history-search-end
  92. bindkey "^p" history-beginning-search-backward-end
  93. bindkey "^b" history-beginning-search-forward-end
  94.  
  95. # cdrコマンドを有効 ログアウトしても有効なディレクトリ履歴
  96. # cdr タブでリストを表示
  97. autoload -Uz add-zsh-hook
  98. autoload -Uz chpwd_recent_dirs cdr
  99. add-zsh-hook chpwd chpwd_recent_dirs
  100. # cdrコマンドで履歴にないディレクトリにも移動可能に
  101. zstyle ":chpwd:*" recent-dirs-default true
  102.  
  103. # 複数ファイルのmv 例 zmv *.txt *.txt.bk
  104. autoload -Uz zmv
  105. alias zmv='noglob zmv -W'
  106.  
  107. # mkdirとcdを同時実行
  108. function mkcd() {
  109. if [[ -d $1 ]]; then
  110. echo "$1 already exists!"
  111. cd $1
  112. else
  113. mkdir -p $1 && cd $1
  114. fi
  115. }
  116.  
  117. # git設定
  118. RPROMPT="%{${fg[blue]}%}[%~]%{${reset_color}%}"
  119. autoload -Uz vcs_info
  120. setopt prompt_subst
  121. zstyle ':vcs_info:git:*' check-for-changes true
  122. zstyle ':vcs_info:git:*' stagedstr "%F{yellow}!"
  123. zstyle ':vcs_info:git:*' unstagedstr "%F{red}+"
  124. zstyle ':vcs_info:*' formats "%F{green}%c%u[%b]%f"
  125. zstyle ':vcs_info:*' actionformats '[%b|%a]'
  126. precmd () { vcs_info }
  127. RPROMPT=$RPROMPT'${vcs_info_msg_0_}'
Add Comment
Please, Sign In to add comment