zshrc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. # default to terminal emacs
  46. alias emacs='emacs -nw'
  47. # alias for getting latest file in a folder
  48. alias latest='ls -t | head -n 1'
  49. # vi bindings
  50. bindkey -v
  51. export KEYTIMEOUT=1
  52. bindkey '^P' up-history
  53. bindkey '^N' down-history
  54. bindkey '^?' backward-delete-char
  55. bindkey '^h' backward-delete-char
  56. bindkey '^w' backward-kill-word
  57. bindkey '^r' history-incremental-search-backward
  58. function zle-line-init zle-keymap-select {
  59. VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
  60. RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  61. zle reset-prompt
  62. }
  63. function zle-line-finish {
  64. VIM_PROMPT=""
  65. RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  66. zle reset-prompt
  67. }
  68. RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  69. zle -N zle-line-init
  70. zle -N zle-keymap-select
  71. # grml
  72. if [ ! $ZSH_CUSTOM ]
  73. then
  74. # enable syntax highlighting
  75. source ~/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  76. # enable C-s for forward search
  77. stty -ixon
  78. fi