.zshrc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. # ls pleasantness
  43. alias l='\ls --color=auto'
  44. alias ls='ls --color=auto'
  45. alias la='ls -a --color=auto'
  46. alias lsa='ls -a --color=auto'
  47. alias lls='ls -lh --color=auto'
  48. alias ll='ls -lh --color=auto'
  49. # Custom ls colors
  50. eval $(dircolors ~/.dircolors)
  51. # Use emacsclient as the default text editor
  52. export EDITOR="emacsclient -t"
  53. export VISUAL="emacsclient -c -a emacs"
  54. # eval used by thefuck
  55. if hash fuck 2>/dev/null; then
  56. eval $(thefuck --alias)
  57. fi
  58. # Home and End keys jump the the beginning/end of the command
  59. bindkey "^[OH" beginning-of-line
  60. bindkey "^[[H" beginning-of-line
  61. bindkey "^[OF" end-of-line
  62. bindkey "^[[F" end-of-line
  63. # Enable forward search
  64. bindkey "^s" history-incremental-search-forward
  65. # Ctrl-Left and Ctrl-Right keys move between words
  66. bindkey ";5C" forward-word
  67. bindkey ";5D" backward-word
  68. # cdls
  69. function cd {
  70. builtin cd "$@" && ls -F
  71. }
  72. function sl_func() {
  73. # sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3
  74. #
  75. LEN=$(ls "$@" |wc -L) # get the length of the longest line
  76. ls "$@" | rev | while read -r line
  77. do
  78. printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/'
  79. done
  80. }
  81. alias sl=sl_func
  82. # vi bindings
  83. #bindkey -v
  84. #export KEYTIMEOUT=1
  85. #
  86. #bindkey '^P' up-history
  87. #bindkey '^N' down-history
  88. #bindkey '^?' backward-delete-char
  89. #bindkey '^h' backward-delete-char
  90. #bindkey '^w' backward-kill-word
  91. #bindkey '^r' history-incremental-search-backward
  92. #
  93. #function zle-line-init zle-keymap-select {
  94. # VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
  95. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  96. # zle reset-prompt
  97. #}
  98. #function zle-line-finish {
  99. # VIM_PROMPT=""
  100. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  101. # zle reset-prompt
  102. #}
  103. #RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  104. #
  105. #zle -N zle-line-init
  106. #zle -N zle-keymap-select