Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. # Created by newuser for 5.2
  2. export PS1='%n@ %~ $ '
  3.  
  4. # 補完候補を一覧で表示する
  5. setopt auto_list
  6. # 補完キー連打で候補順に自動で補完する
  7. setopt auto_menu
  8. # コマンド履歴に実行時間も記録する
  9. setopt extended_history
  10. # 履歴中の重複行をすべて削除する
  11. setopt hist_ignore_all_dups
  12. # コマンド中の余分なスペースは削除して履歴に記録する
  13. setopt hist_reduce_blanks
  14. # バックグラウンド処理の状態変化をすぐに通知する
  15. setopt notify
  16. # = 以降も補完する(例:--option=value)
  17. setopt magic_equal_subst
  18. # 終了ステータスが0以外の場合にステータスを表示する
  19. setopt print_exit_value
  20. # VCS情報の表示を有効にする
  21. setopt prompt_subst
  22. # rm * の前に確認をとる
  23. setopt rm_star_wait
  24. # Zsh間で履歴を共有する
  25. setopt share_history
  26. # コマンド実行後は右プロンプトを消す
  27. setopt transient_rprompt
  28. # ディレクトリと一致すればcd
  29. setopt auto_cd
  30. # コマンドミスを修正
  31. # setopt correct
  32. # 変数を空白で区切る
  33. setopt sh_word_split
  34. # Emacslikeな操作方法
  35. bindkey -e
  36. # メモリに保存する履歴の件数を指定する
  37. export HISTSIZE=1000
  38. # ファイルに保存する履歴の件数を指定する
  39. export SAVEHIST=1000000
  40. # 文字コードを設定する
  41. export LANG=ja_JP.UTF-8
  42. # Shift-Tabで候補を逆順に補完する
  43. bindkey '^[[Z' reverse-menu-complete
  44. # 自動補完を有効にする
  45. autoload -U compinit; compinit
  46. # 補完の表示方法を変更する
  47. zstyle ':completion:*' completer _complete _match _approximate
  48. zstyle ':completion:*' group-name ''
  49. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  50. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  51. zstyle ':completion:*' use-cache true
  52. zstyle ':completion:*' verbose yes
  53. zstyle ':completion:*:default' menu select=2
  54. zstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f'
  55. zstyle ':completion:*:options' description 'yes'
  56. # 履歴ファイルの保存先
  57. export HISTFILE=${HOME}/.zsh_history
  58. # 開始と終了を記録
  59. setopt EXTENDED_HISTORY
  60. # 補完時にヒストリを自動的に展開
  61. setopt hist_expand
  62.  
  63. # cd した先のディレクトリをディレクトリスタックに追加する
  64. # setopt auto_pushd
  65. # pushd したとき、ディレクトリがすでにスタックに含まれていればスタックに追加しない
  66. # setopt pushd_ignore_dups
  67. # 単語の一部として扱われる文字のセットを指定する
  68. WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
  69.  
  70. # 色付け
  71. autoload -Uz colors
  72. colors
  73. # プロンプトの表示設定
  74. PROMPT='%{$fg[blue]%}[%n@%m] %{$fg[yellow]%}%~
  75. %{$fg[white]%}%% %{$reset_color%}'
  76.  
  77. function pcd() {
  78. local PCD_FILE=$HOME/.peco/.peco-cd
  79. local PCD_RETURN
  80. if [ $1 ] && [ $1 = "add" ]; then
  81. if [ $2 ]; then
  82. ADD_DIR=$2
  83. if [ $2 = "." ]; then
  84. ADD_DIR=$(pwd)
  85. fi
  86. echo "add $ADD_DIR to $PCD_FILE"
  87. echo $ADD_DIR >> $PCD_FILE
  88. fi
  89. elif [ $1 ] && [ $1 = "edit" ]; then
  90. if [ $EDITOR ]; then
  91. $EDITOR $PCD_FILE
  92. fi
  93. elif [ $1 ] && [ $1 = "." ]; then
  94. PCD_RETURN=$(/bin/ls -F | grep /$ | sort | peco)
  95. else
  96. PCD_RETURN=$(cat $PCD_FILE | sort | peco)
  97. fi
  98.  
  99. if [ $PCD_RETURN ]; then
  100. cd $PCD_RETURN
  101. fi
  102. }
  103.  
  104.  
  105. function peco-ssh () {
  106. ssh $(awk '
  107. tolower($1)=="host" {
  108. for (i=2; i<=NF; i++) {
  109. if ($i !~ "[*?]") {
  110. print $i
  111. }
  112. }
  113. }
  114. ' ~/.ssh/config | sort | peco --query "$LBUFFER")
  115. }
  116.  
  117. function peco-history-selection() {
  118. BUFFER=`history -n 1 | tail -r | awk '!a[$0]++' | peco`
  119. CURSOR=$#BUFFER
  120. zle reset-prompt
  121. }
  122.  
  123.  
  124. zle -N peco-history-selection
  125. bindkey '^R' peco-history-selection
  126.  
  127. # export PYENV_ROOT=/usr/local/var/pyenv
  128. # eval "$(pyenv init -)"
  129.  
  130. alias ctags="`brew --prefix`/bin/ctags"
  131. export PATH="/usr/local/sbin:$PATH"
  132. # alias emacs="`brew --prefix`/bin/emacs"
  133. alias la='ls -la -G'
  134. alias ll='ls -l -G'
  135.  
  136. PATH=/Applications/Emacs.app/Contents/MacOS/bin:$PATH
  137. alias em="emacsclient -t"
  138. export EDITOR=vim
  139. PATH=~/yukitask:$PATH
  140. source ~/yukitask/command_aliases
  141. source ~/yukitask/here_aliases
  142. alias recent='open ~/yukitask/graph-recent.html'
  143. alias mcp='cp ~/yukitask/makefile.default makefile'
  144.  
  145. alias so='source ~/.zshrc'
  146. alias soe='em ~/.zshrc'
  147.  
  148. source ~/entertainment/enhancd/init.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement