.zshrc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # local zsh config
  2. source ~/.zshrc.local
  3. # load antigen if it exists
  4. if [ -h ~/.antigen.zsh ]
  5. then
  6. save_aliases=$(alias -L)
  7. source ~/.antigen.zsh
  8. # Load oh-my-zsh's library.
  9. antigen use oh-my-zsh
  10. # Bundles from the default repo (robbyrussell's oh-my-zsh).
  11. antigen bundle git
  12. antigen bundle heroku
  13. antigen bundle pip
  14. antigen bundle lein
  15. antigen bundle command-not-found
  16. # Syntax highlighting bundle.
  17. antigen bundle zsh-users/zsh-syntax-highlighting
  18. antigen bundle zsh-users/zsh-autosuggestions
  19. # Load the theme.
  20. antigen theme bureau
  21. # Tell antigen that you're done.
  22. antigen apply
  23. unalias -m '*'
  24. eval $save_aliases; unset save_aliases
  25. fi
  26. bindkey '^ ' autosuggest-accept
  27. # History
  28. HISTFILE=~/.histfile
  29. HISTSIZE=10000
  30. SAVEHIST=10000
  31. # Instantly write history
  32. setopt -o sharehistory
  33. # Ignore duplicates in history
  34. setopt HIST_IGNORE_DUPS
  35. # Delete old recorded entry if new entry is a duplicate.
  36. setopt HIST_IGNORE_ALL_DUPS
  37. setopt appendhistory autocd extendedglob nomatch
  38. # List of word delimeters
  39. WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
  40. # ls pleasantness
  41. alias l='\ls --color=auto'
  42. alias ls='ls --color=auto'
  43. alias la='ls -a --color=auto'
  44. alias lsa='ls -a --color=auto'
  45. alias lls='ls -lh --color=auto'
  46. alias ll='ls -lh --color=auto'
  47. # Custom ls colors
  48. eval $(dircolors ~/.dircolors)
  49. # Use emacsclient as the default text editor
  50. export EDITOR="emacsclient -t"
  51. export VISUAL="emacsclient -c -a emacs"
  52. # eval used by thefuck
  53. if hash fuck 2>/dev/null; then
  54. eval $(thefuck --alias)
  55. fi
  56. # Home and End keys jump the the beginning/end of the command
  57. bindkey "^[OH" beginning-of-line
  58. bindkey "^[[H" beginning-of-line
  59. bindkey "^[OF" end-of-line
  60. bindkey "^[[F" end-of-line
  61. # Enable forward search
  62. bindkey "^s" history-incremental-search-forward
  63. # Ctrl-Left and Ctrl-Right keys move between words
  64. bindkey ";5C" forward-word
  65. bindkey ";5D" backward-word
  66. # cdls
  67. function cd {
  68. builtin cd "$@" && ls -F
  69. }
  70. function sl_func() {
  71. # sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3
  72. #
  73. LEN=$(ls "$@" |wc -L) # get the length of the longest line
  74. ls "$@" | rev | while read -r line
  75. do
  76. printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/'
  77. done
  78. }
  79. alias sl=sl_func
  80. # vi bindings
  81. #bindkey -v
  82. #export KEYTIMEOUT=1
  83. #
  84. #bindkey '^P' up-history
  85. #bindkey '^N' down-history
  86. #bindkey '^?' backward-delete-char
  87. #bindkey '^h' backward-delete-char
  88. #bindkey '^w' backward-kill-word
  89. #bindkey '^r' history-incremental-search-backward
  90. #
  91. #function zle-line-init zle-keymap-select {
  92. # VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
  93. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  94. # zle reset-prompt
  95. #}
  96. #function zle-line-finish {
  97. # VIM_PROMPT=""
  98. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  99. # zle reset-prompt
  100. #}
  101. #RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  102. #
  103. #zle -N zle-line-init
  104. #zle -N zle-keymap-select