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.

226 lines
7.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/zsh
  2. # System-wide profile for interactive zsh(1) shells.
  3. # Setup user specific overrides for this in ~/.zshrc. See zshbuiltins(1)
  4. # and zshoptions(1) for more details.
  5. # Correctly display UTF-8 with combining characters.
  6. if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then
  7. setopt COMBINING_CHARS
  8. fi
  9. export HOMEBREW_NO_AUTO_UPDATE=1
  10. export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers"
  11. export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz"
  12. export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers"
  13. export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz"
  14. export CASE_SENSITIVE="true"
  15. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
  16. export EDITOR=nvim
  17. export GIT_EDITOR=nvim
  18. export BROWSER=chromium
  19. # Disable the log builtin, so we don't conflict with /usr/bin/log
  20. disable log
  21. # Save command history
  22. HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
  23. HISTSIZE=99999999
  24. SAVEHIST=$HISTSIZE
  25. # Beep on error
  26. setopt BEEP
  27. # Use keycodes (generated via zkbd) if present, otherwise fallback on
  28. # values from terminfo
  29. if [[ -r ${ZDOTDIR:-$HOME}/.zkbd/${TERM}-${VENDOR} ]] ; then
  30. source ${ZDOTDIR:-$HOME}/.zkbd/${TERM}-${VENDOR}
  31. else
  32. typeset -g -A key
  33. [[ -n "$terminfo[kf1]" ]] && key[F1]=$terminfo[kf1]
  34. [[ -n "$terminfo[kf2]" ]] && key[F2]=$terminfo[kf2]
  35. [[ -n "$terminfo[kf3]" ]] && key[F3]=$terminfo[kf3]
  36. [[ -n "$terminfo[kf4]" ]] && key[F4]=$terminfo[kf4]
  37. [[ -n "$terminfo[kf5]" ]] && key[F5]=$terminfo[kf5]
  38. [[ -n "$terminfo[kf6]" ]] && key[F6]=$terminfo[kf6]
  39. [[ -n "$terminfo[kf7]" ]] && key[F7]=$terminfo[kf7]
  40. [[ -n "$terminfo[kf8]" ]] && key[F8]=$terminfo[kf8]
  41. [[ -n "$terminfo[kf9]" ]] && key[F9]=$terminfo[kf9]
  42. [[ -n "$terminfo[kf10]" ]] && key[F10]=$terminfo[kf10]
  43. [[ -n "$terminfo[kf11]" ]] && key[F11]=$terminfo[kf11]
  44. [[ -n "$terminfo[kf12]" ]] && key[F12]=$terminfo[kf12]
  45. [[ -n "$terminfo[kf13]" ]] && key[F13]=$terminfo[kf13]
  46. [[ -n "$terminfo[kf14]" ]] && key[F14]=$terminfo[kf14]
  47. [[ -n "$terminfo[kf15]" ]] && key[F15]=$terminfo[kf15]
  48. [[ -n "$terminfo[kf16]" ]] && key[F16]=$terminfo[kf16]
  49. [[ -n "$terminfo[kf17]" ]] && key[F17]=$terminfo[kf17]
  50. [[ -n "$terminfo[kf18]" ]] && key[F18]=$terminfo[kf18]
  51. [[ -n "$terminfo[kf19]" ]] && key[F19]=$terminfo[kf19]
  52. [[ -n "$terminfo[kf20]" ]] && key[F20]=$terminfo[kf20]
  53. [[ -n "$terminfo[kbs]" ]] && key[Backspace]=$terminfo[kbs]
  54. [[ -n "$terminfo[kich1]" ]] && key[Insert]=$terminfo[kich1]
  55. [[ -n "$terminfo[kdch1]" ]] && key[Delete]=$terminfo[kdch1]
  56. [[ -n "$terminfo[khome]" ]] && key[Home]=$terminfo[khome]
  57. [[ -n "$terminfo[kend]" ]] && key[End]=$terminfo[kend]
  58. [[ -n "$terminfo[kpp]" ]] && key[PageUp]=$terminfo[kpp]
  59. [[ -n "$terminfo[knp]" ]] && key[PageDown]=$terminfo[knp]
  60. [[ -n "$terminfo[kcuu1]" ]] && key[Up]=$terminfo[kcuu1]
  61. [[ -n "$terminfo[kcub1]" ]] && key[Left]=$terminfo[kcub1]
  62. [[ -n "$terminfo[kcud1]" ]] && key[Down]=$terminfo[kcud1]
  63. [[ -n "$terminfo[kcuf1]" ]] && key[Right]=$terminfo[kcuf1]
  64. fi
  65. # Default key bindings
  66. [[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
  67. [[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
  68. [[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
  69. [[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search
  70. [[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search
  71. autoload -U colors && colors # Load colors
  72. PROMPT="%{$fg[blue]%}%1~ %{$fg[green]%}>%{$reset_color%} "
  73. setopt autocd # Automatically cd into typed directory.
  74. # Useful support for interacting with Terminal.app or other terminal programs
  75. [ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM"
  76. # Load aliases
  77. source ~/.config/aliasrc
  78. # Load Git completion
  79. zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash
  80. fpath=(~/.zsh $fpath)
  81. # Basic auto/tab complete:
  82. autoload -U compinit
  83. zstyle ':completion:*' menu select
  84. zmodload zsh/complist
  85. compinit
  86. _comp_options+=(globdots) # Include hidden files.
  87. # vi mode
  88. bindkey -v
  89. export KEYTIMEOUT=1
  90. # Use vim keys in tab complete menu:
  91. bindkey -M menuselect 'h' vi-backward-char
  92. bindkey -M menuselect 'k' vi-up-line-or-history
  93. bindkey -M menuselect 'l' vi-forward-char
  94. bindkey -M menuselect 'j' vi-down-line-or-history
  95. bindkey -v '^?' backward-delete-char
  96. # Change cursor shape for different vi modes.
  97. function zle-keymap-select {
  98. if [[ ${KEYMAP} == vicmd ]] ||
  99. [[ $1 = 'block' ]]; then
  100. echo -ne '\e[1 q'
  101. elif [[ ${KEYMAP} == main ]] ||
  102. [[ ${KEYMAP} == viins ]] ||
  103. [[ ${KEYMAP} = '' ]] ||
  104. [[ $1 = 'beam' ]]; then
  105. echo -ne '\e[5 q'
  106. fi
  107. }
  108. zle -N zle-keymap-select
  109. zle-line-init() {
  110. zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
  111. echo -ne "\e[5 q"
  112. }
  113. zle -N zle-line-init
  114. echo -ne '\e[5 q' # Use beam shape cursor on startup.
  115. preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
  116. bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
  117. # Edit line in vim with ctrl-e:
  118. autoload edit-command-line; zle -N edit-command-line
  119. bindkey '^e' edit-command-line
  120. # Load syntax highlighting; should be last.
  121. source ~/.zsh/fsh/fast-syntax-highlighting.plugin.zsh 2>/dev/null
  122. # Go up directory structures
  123. up () {
  124. cd $(printf "%0.0s../" $(seq 1 $1));
  125. }
  126. git-prune () {
  127. if [[ $@ == "--apply" ]]; then
  128. command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d
  129. else
  130. command git branch --merged develop | grep -vEw "develop$|master$"
  131. fi
  132. }
  133. mkcd () {
  134. mkdir -p $@ && cd $@
  135. }
  136. # Use lf to switch directories and bind it to ctrl-o
  137. lfcd () {
  138. tmp="$(mktemp)"
  139. lfpreview -last-dir-path="$tmp" "$@"
  140. if [ -f "$tmp" ]; then
  141. dir="$(cat "$tmp")"
  142. rm -f "$tmp" >/dev/null
  143. [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
  144. fi
  145. }
  146. bindkey -s '^o' 'lfcd\n'
  147. function cdv () {
  148. if [[ $(uname) == 'Darwin' ]]; then
  149. cd $(pbpaste)
  150. return
  151. fi
  152. cd $(xclip -selection clipboard -o)
  153. }
  154. function cdf () {
  155. cd $(find . -type d -print | fzf)
  156. }
  157. export PATH="/usr/local/opt/php@7.4/bin:$PATH"
  158. export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
  159. # eval "$(starship init zsh)"
  160. export LESS='-R'
  161. export LESSOPEN='|~/.lessfilter %s'
  162. export QT_QPA_PLATFORMTHEME="qt5ct"
  163. # Open tmux when new interactive shell
  164. #if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
  165. # exec tmux
  166. #fi
  167. export ANDROID_HOME=$HOME/Android/Sdk
  168. export PATH=$PATH:$ANDROID_HOME/platform-tools
  169. export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
  170. export ANDROID_SDK_ROOT='/opt/android-sdk'
  171. export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
  172. export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/
  173. export PATH=$PATH:$ANDROID_ROOT/emulator
  174. export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
  175. export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
  176. export PATH="/run/user/1000/fnm_multishells/20590_1663546026606/bin":$PATH
  177. export FNM_MULTISHELL_PATH="/run/user/1000/fnm_multishells/20590_1663546026606"
  178. export FNM_VERSION_FILE_STRATEGY="local"
  179. export FNM_DIR="/home/tovi/.local/share/fnm"
  180. export FNM_LOGLEVEL="info"
  181. export FNM_NODE_DIST_MIRROR="https://nodejs.org/dist"
  182. export FNM_ARCH="x64"
  183. rehash