.zshrc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. #export ANTIGEN_CACHE=false
  2. #case $(tty) in
  3. # (/dev/tty[1-9]) _IS_TTY=1;;
  4. # (*) _IS_TTY=0;;
  5. #esac
  6. _IS_TTY=false
  7. if [ -t 1 ]; then
  8. if command -v tput >/dev/null; then
  9. _IS_TTY=true
  10. fi
  11. fi
  12. source /usr/share/zsh/share/antigen.zsh
  13. antigen use oh-my-zsh
  14. if [[ ${_IS_TTY} -eq 0 ]]; then
  15. antigen theme agnoster
  16. else
  17. antigen theme ys
  18. fi
  19. antigen bundle colored-man-pages
  20. antigen bundle docker
  21. antigen bundle gitfast
  22. #antigen bundle tmux
  23. antigen bundle virtualenv
  24. #antigen bundle virtualenvwrapper
  25. antigen bundle ael-code/zsh-gpg-agent
  26. antigen bundle ael-code/zsh-plugin-fasd-fzf
  27. antigen bundle ael-code/zsh-colored-man-pages
  28. antigen bundle gangleri/pipenv
  29. antigen bundle leophys/zsh-plugin-fzf-finder
  30. antigen bundle bobthecow/git-flow-completion
  31. if [[ $_IS_TTY -eq 0 ]]; then
  32. antigen bundle zsh-users/zsh-autosuggestions
  33. fi
  34. antigen bundle junegunn/fzf
  35. antigen apply
  36. # User configuration
  37. # LS_COLORS
  38. # eval `dircolors /home/leo/Documents/coding/dircolors-solarized/dircolors.ansi-dark`
  39. # FASD
  40. eval "$(fasd --init auto)"
  41. # eval "$(pipenv --completion)"
  42. #compdef pipenv
  43. _pipenv() {
  44. eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv)
  45. }
  46. #if [[ "$(basename ${(%):-%x})" != "_pipenv" ]]; then
  47. #autoload -U compinit && compinit
  48. #compdef _pipenv pipenv
  49. #fi
  50. ## Set SSH to use gpg-agent
  51. # unset SSH_AGENT_PID
  52. # if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
  53. # export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
  54. # fi
  55. ## Node and NVM
  56. export NVM_DIR=/home/leo/.nvm
  57. function nvm {
  58. if [ -s "$NVM_DIR/nvm.sh" ]; then
  59. . "$NVM_DIR/nvm.sh"
  60. nvm use system
  61. nvm $@
  62. fi
  63. }
  64. ## Ruby and RVM
  65. [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  66. #export PATH=/home/leo/.gem/ruby/2.5.0/bin:$PATH
  67. #source /home/leo/.rvm/scripts/rvm
  68. #export rvmsudo_secure_path=1
  69. # ## Taken from old .zshrc
  70. #
  71. # dl () {
  72. # emulate -L zsh
  73. # autoload -U colors
  74. # local color=$fg_bold[blue]
  75. # integer i=0
  76. # dirs -p | while read dir
  77. # do
  78. # local num="${$(printf "%-4d " $i)/ /.}"
  79. # printf " %s $color%s$reset_color\n" $num $dir
  80. # (( i++ ))
  81. # done
  82. # integer dir=-1
  83. # read -r 'dir?Jump to directory: ' || return
  84. # (( dir == -1 )) && return
  85. # if (( dir < 0 || dir >= i ))
  86. # then
  87. # echo d: no such directory stack entry: $dir
  88. # return 1
  89. # fi
  90. # cd ~$dir
  91. # }
  92. # Fuckin' TERM env for ssh
  93. if [ "z${TMUX}" = "z" ]; then
  94. function ssh {
  95. TERM=xterm-color /bin/ssh "$@"
  96. }
  97. fi
  98. ## Misc
  99. export MANPATH="/usr/local/man:$MANPATH"
  100. export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
  101. export EDITOR=vim
  102. # You may need to manually set your language environment
  103. export LANG=en_US.UTF-8
  104. if [[ ! -z $TMUX ]]; then
  105. export TERM=tmux-256color
  106. fi
  107. # Preferred editor for local and remote sessions
  108. # if [[ -n $SSH_CONNECTION ]]; then
  109. # export EDITOR='vim'
  110. # else
  111. # export EDITOR='mvim'
  112. # fi
  113. # Compilation flags
  114. # export ARCHFLAGS="-arch x86_64"
  115. # ssh
  116. # export SSH_KEY_PATH="~/.ssh/rsa_id"
  117. # Set personal aliases, overriding those provided by oh-my-zsh libs,
  118. # plugins, and themes. Aliases can be placed here, though oh-my-zsh
  119. # users are encouraged to define aliases within the ZSH_CUSTOM folder.
  120. # For a full list of active aliases, run `alias`.
  121. #
  122. # Example aliases
  123. # alias zshconfig="mate ~/.zshrc"
  124. # alias ohmyzsh="mate ~/.oh-my-zsh"
  125. ## ASDF
  126. . /opt/asdf-vm/asdf.sh
  127. . /opt/asdf-vm/completions/asdf.bash
  128. ## Flutter && Dart
  129. export ANDROID_SDK=/home/leo/Android/Sdk
  130. export PATH=${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:${PATH}
  131. export PATH=$PATH:/opt/flutter/bin/:"$HOME/.pub-cache/bin"
  132. ## Go
  133. export GOPATH=~/.go
  134. export PATH=$PATH:$GOPATH/bin
  135. ## Elixir
  136. export ERL_AFLAGS="-kernel shell_history enabled"
  137. ## Aliases
  138. alias t="tmux -2"
  139. alias sy="systemctl"
  140. alias ssy="sudo systemctl"
  141. alias syu="systemctl --user"
  142. alias sl="cmatrix -b -s"
  143. alias cd..="cmatrix -b -s -C yellow"
  144. alias lt="ls -lt"
  145. alias lh="ls -lh"
  146. alias la="ls -la"
  147. alias ll="ls -l"
  148. alias lrt="ls -lrt"
  149. alias wgpg="gpg --homedir /home/leo/.gnupg-work"
  150. alias agpg="gpg --homedir /home/leo/.gnupg-ai"
  151. # local bin
  152. export PATH=${PATH}:${HOME}/.local/bin
  153. # Completion
  154. eval "$(_CERTO_COMPLETE=source_zsh certo)"
  155. #ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh
  156. #if [[ ! -d $ZSH_CACHE_DIR ]]; then
  157. # mkdir $ZSH_CACHE_DIR
  158. #fi
  159. # source $ZSH/oh-my-zsh.sh
  160. # Setup fzf
  161. # ---------
  162. if [[ ! "$PATH" == */home/leo/Documents/coding/fzf/bin* ]]; then
  163. export PATH="$PATH:/home/leo/Documents/coding/fzf/bin"
  164. fi
  165. # Auto-completion
  166. # ---------------
  167. [[ $- == *i* ]] && source "/home/leo/Documents/coding/fzf/shell/completion.zsh" 2> /dev/null
  168. # Key bindings
  169. # ------------
  170. source "/home/leo/Documents/coding/fzf/shell/key-bindings.zsh"
  171. # Tig
  172. # ---
  173. if [ -f /usr/share/bash-completion/completions/tig ]; then
  174. source /usr/share/bash-completion/completions/tig
  175. fi
  176. # virtualenvwrapper
  177. # -----------------
  178. if [ -f /usr/bin/virtualenvwrapper_lazy.sh ]; then
  179. source /usr/bin/virtualenvwrapper_lazy.sh
  180. fi
  181. # pyenv
  182. # -----
  183. #eval "$(pyenv init -)"
  184. #eval "$(pyenv virtualenv-init -)"
  185. # geoiplookup
  186. # -----------
  187. alias geocityiplookup="geoiplookup -f /usr/share/GeoIP/GeoLiteCity.dat"
  188. # mailbundle
  189. # ----------
  190. alias mutt="neomutt"
  191. alias mailbundle="/opt/mailbundle/config/bin/autorun"
  192. # torbrowser
  193. export PATH=$PATH:/opt/tor-browser_en-US
  194. # platform-tools
  195. # --------------
  196. export PATH=$PATH:/opt/android-sdk/platform-tools
  197. # TMP
  198. # ---
  199. # export FZF_FINDER_BINDKEY='^F'
  200. function lookhosts {
  201. if which rg 2>&1 > /dev/null; then
  202. GREP=rg
  203. else
  204. GREP=grep
  205. fi
  206. ${GREP} $@ /etc/hosts
  207. }
  208. function reload_work_gpg {
  209. kill -9 $(ps aux|egrep "gpg-agent.*work"|grep -v grep|awk '{print $2}')
  210. }
  211. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  212. # vim: et sw=2 ts=2