CLI config/dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

294 lines
11 KiB

  1. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. # .zshrc
  3. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. # User-specific ~/.zshrc, generalized for GNU/Linux and Apple OS X
  5. # Excecuted by zsh for interactive shells
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. # Tab completion settings (added by compinstall)
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10. zstyle ':completion:*' auto-description 'Specify parameter: %d'
  11. zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
  12. zstyle ':completion:*' completions 1
  13. zstyle ':completion:*' expand prefix suffix
  14. zstyle ':completion:*' format 'Completing %d...'
  15. zstyle ':completion:*' glob 1
  16. zstyle ':completion:*' group-name ''
  17. zstyle ':completion:*' ignore-parents parent pwd directory
  18. zstyle ':completion:*' insert-unambiguous true
  19. zstyle ':completion:*' list-colors ''
  20. zstyle ':completion:*' list-prompt %SAt %l: Hit TAB for more, or the character to insert%s
  21. zstyle ':completion:*' list-suffixes true
  22. zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-()@]=** r:|=**' 'l:|=* r:|=*'
  23. zstyle ':completion:*' max-errors 1
  24. zstyle ':completion:*' menu select=long
  25. zstyle ':completion:*' original true
  26. zstyle ':completion:*' preserve-prefix '//[^/]##/'
  27. zstyle ':completion:*' select-prompt %SScrolling active: current selection at %l%s
  28. zstyle ':completion:*' substitute 1
  29. zstyle ':completion:*' verbose true
  30. zstyle :compinstall filename '/home/djsissom/.zshrc'
  31. fpath=(~/.zsh $fpath)
  32. fpath=( "$HOME/.zsh/functions" $fpath )
  33. autoload -Uz compinit && compinit
  34. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. # Shell behavior
  36. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. HISTFILE=~/.histfile
  38. HISTSIZE=2500
  39. SAVEHIST=2500
  40. setopt appendhistory extendedglob nomatch notify
  41. unsetopt autocd beep
  42. bindkey -v # emulate vi keybindings
  43. bindkey "^?" backward-delete-char # fix backspacing over newlines
  44. bindkey '^R' history-incremental-pattern-search-backward # search
  45. bindkey '^F' history-incremental-pattern-search-forward # search
  46. setopt HIST_IGNORE_DUPS
  47. setopt RM_STAR_SILENT
  48. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. # Create a zkbd compatible hash (see man 5 terminfo to add other keys)
  50. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. typeset -A key
  52. key[Home]=${terminfo[khome]}
  53. key[End]=${terminfo[kend]}
  54. key[Insert]=${terminfo[kich1]}
  55. key[Delete]=${terminfo[kdch1]}
  56. key[Up]=${terminfo[kcuu1]}
  57. key[Down]=${terminfo[kcud1]}
  58. key[Left]=${terminfo[kcub1]}
  59. key[Right]=${terminfo[kcuf1]}
  60. key[PageUp]=${terminfo[kpp]}
  61. key[PageDown]=${terminfo[knp]}
  62. [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
  63. [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
  64. [[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
  65. [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
  66. [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
  67. [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
  68. [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
  69. [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
  70. [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
  71. [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
  72. # Finally, make sure the terminal is in application mode, when zle is active.
  73. # Only then are the values from $terminfo valid.
  74. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  75. function zle-line-init () {
  76. printf '%s' "${terminfo[smkx]}"
  77. }
  78. function zle-line-finish () {
  79. printf '%s' "${terminfo[rmkx]}"
  80. }
  81. zle -N zle-line-init
  82. zle -N zle-line-finish
  83. fi
  84. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  85. # Source external definitions
  86. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. [ -r ~/.colornames ] && . ~/.colornames # Human-readable color variables
  88. autoload -U colors && colors
  89. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. # Determine local environment
  91. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. case $( uname ) in
  93. ( *[Ll]inux* )
  94. case "$HOSTNAME" in
  95. ( vmp* ) host='cluster';; # Auto-detect whether we're running on the
  96. ( vpac* ) host='astro';; # ACCRE cluster or the VPAC network at
  97. ( * ) host='linux';; # Vanderbilt, and set options appropriately
  98. esac;;
  99. ( *[Dd]arwin* ) host='osx';;
  100. ( * ) echo 'running on unknown host' && return;;
  101. esac
  102. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103. # Import packages
  104. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. if [[ $host == cluster ]]; then
  106. setpkgs -a gcc_compiler
  107. setpkgs -a intel_compiler
  108. setpkgs -a fftw2-mpich2_gcc_ether
  109. setpkgs -a mpich2_gcc_ether
  110. setpkgs -a gsl_gcc
  111. setpkgs -a gsl_intel
  112. setpkgs -a hdf5
  113. setpkgs -a valgrind
  114. setpkgs -a python
  115. setpkgs -a scipy
  116. setpkgs -a perl
  117. setpkgs -a idl-8.0
  118. setpkgs -a matlab
  119. setpkgs -a octave
  120. setpkgs -a R
  121. setpkgs -a ImageMagick
  122. fi
  123. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  124. # Path definitions
  125. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126. typeset -U path
  127. case "$host" in
  128. ( cluster )
  129. path=(/usr/local/supermongo/bin # Supermongo path
  130. /usr/local/cuda/bin # Nvidia CUDA path
  131. /usr/lpp/mmfs/bin # GPFS utilities path
  132. ~/local/bin # User-specific path
  133. $path)
  134. export -UT LD_LIBRARY_PATH=/usr/scheduler/torque/lib:$LD_LIBRARY_PATH ld_library_path
  135. export -UT LD_LIBRARY_PATH=/usr/local/supermongo/lib:$LD_LIBRARY_PATH ld_library_path
  136. export -UT LD_LIBRARY_PATH=/usr/local/python/lib:$LD_LIBRARY_PATH ld_library_path
  137. export -UT LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH ld_library_path
  138. export -UT PYTHONPATH=~/local/lib/python/site-packages:$PYTHONPATH pythonpath
  139. export -UT IDL_STARTUP=~/.idl/idl_startup.pro idl_starup
  140. export -UT IDL_PATH=+/home/sinham/utils/idl:$IDL_PATH idl_path
  141. export -UT IDL_PATH=.:+/usr/local/idl/idl/lib:+/usr/local/idl/idl/:$IDL_PATH idl_path
  142. ;;
  143. ( astro )
  144. path=(/usr/local/python64/bin # Python path (64 bit)
  145. ~/local/bin # User specific path
  146. $path)
  147. export -UT LD_LIBRARY_PATH=/usr/local/python64/lib:$LD_LIBRARY_PATH ld_library_path
  148. export -UT PYTHONPATH=~/local/lib/python/latest/site-packages:$PYTHONPATH pythonpath
  149. export -UT PYTHONPATH=/usr/local/python64/lib/python*/site-packages:$PYTHONPATH pythonpath
  150. source /usr/local/itt/idl80/idl/bin/idl_setup.bash
  151. export IDL_PATH=.:/home/sinham/psu/utils/idl/:+$IDL_DIR
  152. export IDL_STARTUP=~/.idl/idl_startup.pro
  153. ;;
  154. ( linux )
  155. path=(~/Local/bin $path) # User specific path
  156. export -UT PYTHONPATH=~/Local/lib/python/python-2.7/site-packages:$PYTHONPATH pythonpath
  157. export -UT PYTHONPATH=~/Local/lib/python/latest/site-packages:$PYTHONPATH pythonpath
  158. export -UT PYTHONPATH=~/Local/lib/python3/site-packages:$PYTHONPATH pythonpath
  159. export -UT TEXINPUTS=.:./style:$TEXINPUTS texinputs
  160. export -UT BSTINPUTS=.:./style:$BSTINPUTS bstinputs
  161. export -UT BIBINPUTS=.:./style:$BIBINPUTS bibinputs
  162. ;;
  163. ( osx )
  164. path=(~/Local/bin # User specific path
  165. /usr/local/opt/coreutils/libexec/gnubin # Gnu coreutils from Homebrew
  166. /usr/local/opt/findutils/libexec/gnubin # Gnu find from Homebrew
  167. /usr/local/opt/grep/libexec/gnubin # Gnu grep from Homebrew
  168. /usr/local/opt/gnu-sed/libexec/gnubin # Gnu sed from Homebrew
  169. /usr/local/opt/gnu-indent/libexec/gnubin # Gnu indent from Homebrew
  170. /usr/local/opt/gnu-tar/libexec/gnubin # Gnu tar from Homebrew
  171. /usr/local/opt/python/libexec/bin # Unversioned python3
  172. $path)
  173. export -UT PYTHONPATH=~/Local/lib/python/latest/site-packages:$PYTHONPATH pythonpath
  174. ;;
  175. esac
  176. export path
  177. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  178. # Shell behavior
  179. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  180. if [[ $host == osx ]]; then
  181. export EDITOR='vim' # Use vim as default text editor
  182. else
  183. export EDITOR='vim -display none' # Use vim as default text editor
  184. fi
  185. export GPG_TTY=$(tty) # Fix GPG pin prompt bug with git
  186. export SDL_VIDEO_FULLSCREEN_HEAD=3
  187. setopt HIST_IGNORE_SPACE
  188. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  189. # Source alias definitions file
  190. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  191. [ -r ~/.aliases ] && . ~/.aliases
  192. setopt complete_aliases
  193. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  194. # Program-specific settings and fixes
  195. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  196. # make less more friendly for non-text input files, see lesspipe(1)
  197. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  198. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199. # User-defined functions
  200. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201. # Enable user-passable growl notifications
  202. growl() { echo -e $'\e]9;'${1}'\007' ; return ; }
  203. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  204. # Set up command line syntax highlighting plugin
  205. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  206. zsh_hl_path=/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  207. [ -r $zsh_hl_path ] && source $zsh_hl_path
  208. ZSH_HIGHLIGHT_HIGHLIGHTERS=(brackets root) # options: main brackets pattern cursor root line
  209. #ZSH_HIGHLIGHT_STYLES[unknown-token]='none' # example to customize main class tokens
  210. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  211. # Set up prompt
  212. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  213. autoload -Uz promptinit && promptinit
  214. PURE_GIT_PULL=0
  215. prompt pure
  216. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217. # End
  218. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~