.zshrc 1.9 KB

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