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.

224 lines
7.1 KiB

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