.zshrc 2.0 KB

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