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.

194 lines
6.7 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=10000
  39. SAVEHIST=10000
  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. # Shell behavior
  91. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. if [[ $hostenv == osx ]]; then
  93. export EDITOR='vim' # Use vim as default text editor
  94. else
  95. export EDITOR='vim -display none' # Use vim as default text editor
  96. fi
  97. export GPG_TTY=$(tty) # Fix GPG pin prompt bug with git
  98. export SDL_VIDEO_FULLSCREEN_HEAD=3
  99. setopt HIST_IGNORE_SPACE
  100. #tabs 4 # Set default tab stop at 4 spaces
  101. if [[ $HOST == motoko ]]; then
  102. export TERM=xterm-256color
  103. fi
  104. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. # Source alias definitions file
  106. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  107. [ -r ~/.aliases ] && . ~/.aliases
  108. setopt complete_aliases
  109. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110. # Program-specific settings and fixes
  111. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112. # make less more friendly for non-text input files, see lesspipe(1)
  113. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  114. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  115. # User-defined functions
  116. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117. # Enable user-passable growl notifications
  118. growl() { echo -e $'\e]9;'${1}'\007' ; return ; }
  119. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120. # Set up command line syntax highlighting plugin
  121. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122. zsh_hl_path=/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  123. [ -r $zsh_hl_path ] && source $zsh_hl_path
  124. ZSH_HIGHLIGHT_HIGHLIGHTERS=(brackets root) # options: main brackets pattern cursor root line
  125. #ZSH_HIGHLIGHT_STYLES[unknown-token]='none' # example to customize main class tokens
  126. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127. # Set up prompt
  128. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  129. autoload -Uz promptinit && promptinit
  130. prompt pure
  131. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  132. # End
  133. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~