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.

138 lines
3.2 KiB

5 years ago
11 months ago
4 weeks ago
5 years ago
11 months ago
5 years ago
5 years ago
5 years ago
5 years ago
11 months ago
1 month ago
1 month ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
4 days ago
1 month ago
4 weeks ago
11 months ago
  1. #!/bin/zsh
  2. # Speed debugging
  3. # zmodload zsh/zprof
  4. stty -ixon
  5. if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then
  6. setopt COMBINING_CHARS
  7. fi
  8. # Disable the log builtin, so we don't conflict with /usr/bin/log
  9. disable log
  10. # Save command history
  11. HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
  12. HISTSIZE=99999999
  13. SAVEHIST=$HISTSIZE
  14. # Variables
  15. export CASE_SENSITIVE="true"
  16. export EDITOR=nvim
  17. export GIT_EDITOR=nvim
  18. export PATH="${HOME}/.local/bin/:${HOME}/go/bin:${HOME}/.cargo/bin:${PATH}"
  19. # export DOCKER_DEFAULT_PLATFORM=linux/amd64
  20. # Enable substitution in the prompt.
  21. setopt prompt_subst
  22. function git_branch_name() {
  23. branch=$(git symbolic-ref HEAD 2> /dev/null | sed 's/refs\/heads\///g')
  24. if [[ $branch != "" ]]; then
  25. echo "- ${branch} "
  26. fi
  27. }
  28. PROMPT='%{$fg[blue]%}%1~ %{$fg[magenta]%}$(git_branch_name)%{$fg[green]%}>%{$reset_color%} '
  29. # Set some options if running on mac
  30. if [[ $(uname) == 'Darwin' ]]; then
  31. export HOMEBREW_NO_AUTO_UPDATE=1
  32. export PATH="/opt/homebrew/lib/ruby/gems/3.3.0:$PATH"
  33. export PATH="/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0:$PATH"
  34. eval "$(/opt/homebrew/bin/brew shellenv)"
  35. fi
  36. autoload -Uz compinit
  37. if [[ -f "${ZDOTDIR}/.zcompdump" && "${ZDOTDIR}/.zcompdump" -nt "${ZDOTDIR}/.zshrc" ]]; then
  38. compinit
  39. else
  40. compinit -C
  41. fi
  42. # Auto complete case insensitive
  43. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
  44. # Load colors
  45. autoload -U colors && colors
  46. # Automatically cd into typed directory.
  47. setopt autocd
  48. # Useful support for interacting with Terminal.app or other terminal programs
  49. [ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM"
  50. # Load Git completion
  51. zstyle ':completion:*:*:git:*' script "${ZDOTDIR}/.zsh/git-completion.bash"
  52. fpath=(~/.zsh $fpath)
  53. # vi mode
  54. bindkey -v
  55. export KEYTIMEOUT=1
  56. # Edit line in vim with ctrl-e:
  57. autoload edit-command-line; zle -N edit-command-line
  58. bindkey '^e' edit-command-line
  59. # Go up directory structures
  60. up () {
  61. cd $(printf "%0.0s../" $(seq 1 $1));
  62. }
  63. # cd with fzf
  64. function cdf () {
  65. cd $(find . -type d -print | fzf)
  66. }
  67. # Android dev config
  68. export ANDROID_HOME="$HOME/Android/Sdk"
  69. if [[ $(uname) == 'Darwin' ]]; then
  70. export ANDROID_HOME="$HOME/Library/Android/sdk"
  71. export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
  72. else
  73. export PATH="${PATH}:${ANDROID_HOME}/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin"
  74. fi
  75. export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
  76. export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
  77. # Load nvm on load to speed up shell init
  78. function nvm() {
  79. unset -f nvm node npm npx
  80. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  81. nvm "$@"
  82. }
  83. function node { nvm; node "$@" }
  84. function npm { nvm; npm "$@" }
  85. function npx { nvm; npx "$@" }
  86. # Load external aliases
  87. source ~/.config/aliasrc
  88. # Source fzf for Ctrl+r
  89. source <(fzf --zsh)
  90. if [ -f "$HOME/.cargo/env" ]; then
  91. . "$HOME/.cargo/env"
  92. fi
  93. if [ -f "$HOME/.config/zsh/.api-keys" ]; then
  94. source "$HOME/.config/zsh/.api-keys"
  95. fi
  96. bindkey -s '^F' "$HOME/.local/bin/tmux-sessionizer\n"
  97. export PATH=~/.config/composer/vendor/bin:$PATH
  98. export PATH="/opt/flutter/bin:$PATH"
  99. export PATH="$PATH":"$HOME/.pub-cache/bin"
  100. # Speed debugging
  101. # zprof