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.

97 lines
2.3 KiB

4 years ago
4 months ago
4 years ago
4 months ago
4 years ago
4 years ago
4 years ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. #!/bin/zsh
  2. # Speed debugging
  3. # zmodload zsh/zprof
  4. if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then
  5. setopt COMBINING_CHARS
  6. fi
  7. # Disable the log builtin, so we don't conflict with /usr/bin/log
  8. disable log
  9. # Save command history
  10. HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
  11. HISTSIZE=99999999
  12. SAVEHIST=$HISTSIZE
  13. # Variables
  14. export CASE_SENSITIVE="true"
  15. export EDITOR=nvim
  16. export GIT_EDITOR=nvim
  17. export PATH="${HOME}/.local/bin/:${HOME}/go/bin:${HOME}/.cargo/bin:${PATH}"
  18. PROMPT="%{$fg[blue]%}%1~ %{$fg[green]%}>%{$reset_color%} "
  19. # Set some options if running on mac
  20. if [[ $(uname) == 'Darwin' ]]; then
  21. export HOMEBREW_NO_AUTO_UPDATE=1
  22. export PATH="/opt/homebrew/lib/ruby/gems/3.3.0:$PATH"
  23. export PATH="/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0:$PATH"
  24. eval "$(rbenv init - zsh)"
  25. fi
  26. # Auto complete case insensitive
  27. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
  28. # Load colors
  29. autoload -U colors && colors
  30. # Automatically cd into typed directory.
  31. setopt autocd
  32. # Useful support for interacting with Terminal.app or other terminal programs
  33. [ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM"
  34. # Load Git completion
  35. zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash
  36. fpath=(~/.zsh $fpath)
  37. # vi mode
  38. bindkey -v
  39. export KEYTIMEOUT=1
  40. # Edit line in vim with ctrl-e:
  41. autoload edit-command-line; zle -N edit-command-line
  42. bindkey '^e' edit-command-line
  43. # Go up directory structures
  44. up () {
  45. cd $(printf "%0.0s../" $(seq 1 $1));
  46. }
  47. # cd with fzf
  48. function cdf () {
  49. cd $(find . -type d -print | fzf)
  50. }
  51. # Android dev config
  52. export ANDROID_HOME="$HOME/Android/Sdk"
  53. if [[ $(uname) == 'Darwin' ]]; then
  54. export ANDROID_HOME="$HOME/Library/Android/sdk"
  55. export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
  56. fi
  57. export PATH="${PATH}:${ANDROID_HOME}/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin"
  58. # Load nvm on load to speed up shell init
  59. function nvm {
  60. unset -f nvm node npm npx
  61. export NVM_DIR="$HOME/.nvm"
  62. [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
  63. [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
  64. nvm "$@"
  65. }
  66. function node { nvm; node "$@" }
  67. function npm { nvm; npm "$@" }
  68. function npx { nvm; npx "$@" }
  69. # Load external aliases
  70. source ~/.config/aliasrc
  71. # Source fzf for Ctrl+r
  72. source <(fzf --zsh)
  73. # Speed debugging
  74. # zprof