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.

204 lines
7.0 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. # Hack to fix urxvt starting with a prompt in the middle - delete when fixed
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10. if [[ $hostenv == 'linux' && `ps ho command $(ps ho ppid $$)` == 'urxvt' ]]; then
  11. clear
  12. fi
  13. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. # Tab completion settings (added by compinstall)
  15. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. zstyle ':completion:*' auto-description 'Specify parameter: %d'
  17. zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate _files
  18. zstyle ':completion:*' completions 1
  19. zstyle ':completion:*' expand prefix suffix
  20. zstyle ':completion:*' format 'Completing %d...'
  21. zstyle ':completion:*' glob 1
  22. zstyle ':completion:*' group-name ''
  23. zstyle ':completion:*' ignore-parents parent pwd directory
  24. zstyle ':completion:*' insert-unambiguous true
  25. zstyle ':completion:*' list-colors ''
  26. zstyle ':completion:*' list-prompt %SAt %l: Hit TAB for more, or the character to insert%s
  27. zstyle ':completion:*' list-suffixes true
  28. zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-()@]=** r:|=**' 'l:|=* r:|=*'
  29. zstyle ':completion:*' max-errors 1
  30. zstyle ':completion:*' menu select=long
  31. zstyle ':completion:*' original true
  32. zstyle ':completion:*' preserve-prefix '//[^/]##/'
  33. zstyle ':completion:*' select-prompt %SScrolling active: current selection at %l%s
  34. zstyle ':completion:*' substitute 1
  35. zstyle ':completion:*' verbose true
  36. zstyle :compinstall filename '/home/djsissom/.zshrc'
  37. fpath=(~/.zsh $fpath)
  38. fpath=( "$HOME/.zsh/functions" $fpath )
  39. autoload -Uz compinit && compinit
  40. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  41. # Shell behavior
  42. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. HISTFILE=~/.histfile
  44. HISTSIZE=10000
  45. SAVEHIST=10000
  46. setopt appendhistory extendedglob nomatch notify
  47. unsetopt autocd beep
  48. bindkey -v # emulate vi keybindings
  49. bindkey "^?" backward-delete-char # fix backspacing over newlines
  50. bindkey '^R' history-incremental-pattern-search-backward # search
  51. bindkey '^F' history-incremental-pattern-search-forward # search
  52. setopt HIST_IGNORE_DUPS
  53. setopt RM_STAR_SILENT
  54. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. # Create a zkbd compatible hash (see man 5 terminfo to add other keys)
  56. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  57. typeset -A key
  58. key[Home]=${terminfo[khome]}
  59. key[End]=${terminfo[kend]}
  60. key[Insert]=${terminfo[kich1]}
  61. key[Delete]=${terminfo[kdch1]}
  62. key[Up]=${terminfo[kcuu1]}
  63. key[Down]=${terminfo[kcud1]}
  64. key[Left]=${terminfo[kcub1]}
  65. key[Right]=${terminfo[kcuf1]}
  66. key[PageUp]=${terminfo[kpp]}
  67. key[PageDown]=${terminfo[knp]}
  68. [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
  69. [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
  70. [[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
  71. [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
  72. [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
  73. [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
  74. [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
  75. [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
  76. [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
  77. [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
  78. # Finally, make sure the terminal is in application mode, when zle is active.
  79. # Only then are the values from $terminfo valid.
  80. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  81. function zle-line-init () {
  82. printf '%s' "${terminfo[smkx]}"
  83. }
  84. function zle-line-finish () {
  85. printf '%s' "${terminfo[rmkx]}"
  86. }
  87. zle -N zle-line-init
  88. zle -N zle-line-finish
  89. fi
  90. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91. # Source external definitions
  92. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  93. [ -r ~/.colornames ] && . ~/.colornames # Human-readable color variables
  94. autoload -U colors && colors
  95. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  96. # Shell behavior
  97. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  98. if [[ $hostenv == osx ]]; then
  99. export EDITOR='vim' # Use vim as default text editor
  100. else
  101. export EDITOR='vim -display none' # Use vim as default text editor
  102. fi
  103. export GPG_TTY=$(tty) # Fix GPG pin prompt bug with git
  104. export SDL_VIDEO_FULLSCREEN_HEAD=3
  105. setopt HIST_IGNORE_SPACE
  106. #tabs 4 # Set default tab stop at 4 spaces
  107. if [[ $HOST == motoko ]]; then
  108. export TERM=xterm-256color
  109. fi
  110. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. # Source alias definitions file
  112. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  113. [ -r ~/.aliases ] && . ~/.aliases
  114. setopt complete_aliases
  115. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  116. # Program-specific settings and fixes
  117. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118. # make less more friendly for non-text input files, see lesspipe(1)
  119. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  120. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. # User-defined functions
  122. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123. # Enable user-passable growl notifications
  124. growl() { echo -e $'\e]9;'${1}'\007' ; return ; }
  125. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126. # Set up command line syntax highlighting plugin
  127. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  128. zsh_hl_path=/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  129. [ -r $zsh_hl_path ] && source $zsh_hl_path
  130. ZSH_HIGHLIGHT_HIGHLIGHTERS=(brackets root) # options: main brackets pattern cursor root line
  131. #ZSH_HIGHLIGHT_STYLES[unknown-token]='none' # example to customize main class tokens
  132. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133. # Set up prompt
  134. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135. autoload -Uz promptinit && promptinit
  136. prompt pure
  137. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  138. # End
  139. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~