.zshrc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # local zsh config
  2. if [ -f ~/.zshrc.local ]; then
  3. source ~/.zshrc.local
  4. fi
  5. # load antigen if it exists
  6. if [ -h ~/.antigen.zsh ]
  7. then
  8. save_aliases=$(alias -L)
  9. source ~/.antigen.zsh
  10. # Load oh-my-zsh's library.
  11. antigen use oh-my-zsh
  12. # Bundles from the default repo (robbyrussell's oh-my-zsh).
  13. antigen bundle git
  14. antigen bundle heroku
  15. antigen bundle pip
  16. antigen bundle lein
  17. antigen bundle command-not-found
  18. export NVM_LAZY_LOAD=true
  19. export NVM_NO_USE=true
  20. antigen bundle lukechilds/zsh-nvm
  21. # Syntax highlighting bundle.
  22. antigen bundle zsh-users/zsh-syntax-highlighting
  23. antigen bundle zsh-users/zsh-autosuggestions
  24. # Load the theme.
  25. antigen theme simple
  26. # Tell antigen that you're done.
  27. antigen apply
  28. unalias -m '*'
  29. eval $save_aliases; unset save_aliases
  30. fi
  31. bindkey '^ ' autosuggest-accept
  32. # History
  33. HISTFILE=~/.histfile
  34. HISTSIZE=10000
  35. SAVEHIST=10000
  36. # Instantly write history
  37. setopt -o sharehistory
  38. # Ignore duplicates in history
  39. setopt HIST_IGNORE_DUPS
  40. # Delete old recorded entry if new entry is a duplicate.
  41. setopt HIST_IGNORE_ALL_DUPS
  42. setopt appendhistory autocd extendedglob nomatch
  43. # List of word delimeters
  44. WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
  45. # Home and End keys jump the the beginning/end of the command
  46. bindkey "^[OH" beginning-of-line
  47. bindkey "^[[H" beginning-of-line
  48. bindkey "^[OF" end-of-line
  49. bindkey "^[[F" end-of-line
  50. # Enable forward search
  51. bindkey "^s" history-incremental-search-forward
  52. # Ctrl-Left and Ctrl-Right keys move between words
  53. bindkey ";5C" forward-word
  54. bindkey ";5D" backward-word
  55. # cdls
  56. function cd {
  57. builtin cd "$@" && ls -F
  58. }
  59. function sl_func() {
  60. # sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3
  61. #
  62. LEN=$(ls "$@" |sort -nr|head -1|wc -c) # get the length of the longest line
  63. ls "$@" | rev | while read -r line
  64. do
  65. builtin printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/'
  66. done
  67. }
  68. alias sl=sl_func