zshrc 2.2 KB

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