zshrc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # local zsh config
  2. source ~/.zshrc.local
  3. # load antigen if it exists
  4. if [ -h ~/.antigen.zsh ]
  5. then
  6. source ~/.antigen.zsh
  7. # Load oh-my-zsh's library.
  8. antigen use oh-my-zsh
  9. # Bundles from the default repo (robbyrussell's oh-my-zsh).
  10. antigen bundle git
  11. antigen bundle heroku
  12. antigen bundle pip
  13. antigen bundle lein
  14. antigen bundle command-not-found
  15. # Syntax highlighting bundle.
  16. antigen bundle zsh-users/zsh-syntax-highlighting
  17. # Load the theme.
  18. antigen theme bira
  19. # Tell antigen that you're done.
  20. antigen apply
  21. fi
  22. # History
  23. HISTFILE=~/.histfile
  24. HISTSIZE=10000
  25. SAVEHIST=10000
  26. # Instantly write history
  27. setopt -o sharehistory
  28. # Ignore duplicates in history
  29. setopt HIST_IGNORE_DUPS
  30. # Delete old recorded entry if new entry is a duplicate.
  31. setopt HIST_IGNORE_ALL_DUPS
  32. setopt appendhistory autocd extendedglob nomatch
  33. bindkey -e
  34. zstyle :compinstall filename '/home/josh/.zshrc'
  35. autoload -Uz compinit
  36. compinit -u
  37. # List of word delimeters
  38. WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
  39. # ls pleasantness
  40. alias l='\ls --color=auto'
  41. alias ls='ls --color=auto'
  42. alias la='ls -a --color=auto'
  43. alias lsa='ls -a --color=auto'
  44. alias lls='ls -lh --color=auto'
  45. alias ll='ls -lh --color=auto'
  46. # Use vim as the default text editor
  47. export VISUAL=vim
  48. # Ctrl-Left and Ctrl-Right keys move between words
  49. bindkey ";5C" forward-word
  50. # bindkey "^[[C" forward-word
  51. bindkey ";5D" backward-word
  52. # bindkey "^[[D" backward-word
  53. # alias for vim muscle memory when quitting
  54. alias :q='exit'
  55. # eval used by thefuck
  56. if hash fuck 2>/dev/null; then
  57. eval $(thefuck --alias)
  58. fi
  59. # timestamp alias for dates
  60. alias ts='date +%y-%m-%d'
  61. # alias for getting latest file in a folder
  62. alias latest='ls -t | head -n 1'
  63. # vi bindings
  64. bindkey -v
  65. export KEYTIMEOUT=1
  66. bindkey '^P' up-history
  67. bindkey '^N' down-history
  68. bindkey '^?' backward-delete-char
  69. bindkey '^h' backward-delete-char
  70. bindkey '^w' backward-kill-word
  71. bindkey '^r' history-incremental-search-backward
  72. function zle-line-init zle-keymap-select {
  73. VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
  74. RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  75. zle reset-prompt
  76. }
  77. function zle-line-finish {
  78. VIM_PROMPT=""
  79. RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  80. zle reset-prompt
  81. }
  82. RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  83. zle -N zle-line-init
  84. zle -N zle-keymap-select
  85. # Home and End keys jump the the beginning/end of the command
  86. bindkey "^[OH" beginning-of-line
  87. bindkey "^[[H" beginning-of-line
  88. bindkey "^[OF" end-of-line
  89. bindkey "^[[F" end-of-line
  90. # Enable forward search
  91. bindkey "^s" history-incremental-search-forward