.zshrc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 vim as the default text editor
  50. export VISUAL=vim
  51. # eval used by thefuck
  52. if hash fuck 2>/dev/null; then
  53. eval $(thefuck --alias)
  54. fi
  55. # timestamp alias for dates
  56. alias ts='date +%y-%m-%d'
  57. # alias for getting latest file in a folder
  58. alias latest='ls -t | head -n 1'
  59. # Home and End keys jump the the beginning/end of the command
  60. bindkey "^[OH" beginning-of-line
  61. bindkey "^[[H" beginning-of-line
  62. bindkey "^[OF" end-of-line
  63. bindkey "^[[F" end-of-line
  64. # Enable forward search
  65. bindkey "^s" history-incremental-search-forward
  66. # Ctrl-Left and Ctrl-Right keys move between words
  67. bindkey ";5C" forward-word
  68. bindkey ";5D" backward-word
  69. # cdls
  70. function cd {
  71. builtin cd "$@" && ls -F
  72. }
  73. # Editor defaults
  74. export EDITOR=emacs
  75. export VISUAL=emacs
  76. # Terminal Emacs
  77. alias emacs-term='\emacs -nw'
  78. # Vim and vi bindings
  79. # alias for vim muscle memory when quitting
  80. alias :q='exit'
  81. function sl_func() {
  82. # sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3
  83. #
  84. LEN=$(ls "$@" |wc -L) # get the length of the longest line
  85. ls "$@" | rev | while read -r line
  86. do
  87. printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/'
  88. done
  89. }
  90. alias sl=sl_func
  91. # vi bindings
  92. #bindkey -v
  93. #export KEYTIMEOUT=1
  94. #
  95. #bindkey '^P' up-history
  96. #bindkey '^N' down-history
  97. #bindkey '^?' backward-delete-char
  98. #bindkey '^h' backward-delete-char
  99. #bindkey '^w' backward-kill-word
  100. #bindkey '^r' history-incremental-search-backward
  101. #
  102. #function zle-line-init zle-keymap-select {
  103. # VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
  104. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  105. # zle reset-prompt
  106. #}
  107. #function zle-line-finish {
  108. # VIM_PROMPT=""
  109. # RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  110. # zle reset-prompt
  111. #}
  112. #RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
  113. #
  114. #zle -N zle-line-init
  115. #zle -N zle-keymap-select