zshrc 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. # MY OWN SETTINGS
  2. # source $ZSH/oh-my-zsh.sh
  3. # History
  4. #
  5. # хранить историю в указанном файле
  6. export HISTFILE=~/.term_history
  7. # Игнорируются команды начинающиеся с пробела
  8. export HISTCONTROL=$HISTCONTROL:ignorespace
  9. # максимальное число команд, хранимых в сеансе
  10. export HISTSIZE=50000
  11. export SAVEHIST=$HISTSIZE
  12. # включить историю команд
  13. setopt APPEND_HISTORY
  14. # убрать повторяющиеся команды, пустые строки и пр.
  15. setopt HIST_IGNORE_ALL_DUPS
  16. setopt HIST_IGNORE_SPACE
  17. setopt HIST_REDUCE_BLANKS
  18. # Вытянуть из бинарника шеллкод
  19. objdumptoshellcode (){
  20. for i in $(objdump -d $1 -M intel | grep "^ " | cut -f2); do
  21. echo -En '\x'$i
  22. done
  23. echo
  24. }
  25. # Запаковать архив
  26. # example: pk tar file
  27. pk () {
  28. if [ $1 ] ; then
  29. case $1 in
  30. tbz) tar cjvf $2.tar.bz2 $2 ;;
  31. tgz) tar czvf $2.tar.gz $2 ;;
  32. tar) tar cpvf $2.tar $2 ;;
  33. bz2) bzip $2 ;;
  34. gz) gzip -c -9 -n $2 > $2.gz ;;
  35. zip) zip -r $2.zip $2 ;;
  36. 7z) 7z a $2.7z $2 ;;
  37. *) echo "'$1' cannot be packed via pk()" ;;
  38. esac
  39. else
  40. echo "'$1' is not a valid file"
  41. fi
  42. }
  43. # Распаковка архивов
  44. # example: extract file
  45. unpk () {
  46. if [ -f $1 ] ; then case $1 in
  47. *.tar.bz2) tar xjf $1 ;;
  48. *.tar.gz) tar xzf $1 ;;
  49. *.bz2) bunzip2 $1 ;;
  50. *.rar) unrar x $1 ;;
  51. *.gz) gunzip $1 ;;
  52. *.tar) tar xf $1 ;;
  53. *.tbz2) tar xjf $1 ;;
  54. *.tbz) tar -xjvf $1 ;;
  55. *.tgz) tar xzf $1 ;;
  56. *.zip) unzip $1 ;;
  57. *.Z) uncompress $1 ;;
  58. *.7z) 7z x $1 ;;
  59. *) echo "I don't know how to extract '$1'..." ;;
  60. esac
  61. else
  62. echo "'$1' is not a valid file"
  63. fi
  64. }
  65. # ----------------------
  66. # autoload -U compinit promptinit
  67. autoload -Uz compinit ; compinit
  68. autoload -Uz promptinit; promptinit
  69. setopt autocd
  70. autoload -U pick-web-browser
  71. alias -s {html,htm}=firefox
  72. alias -s {py,js}=nvim
  73. alias rm='rm -i'
  74. alias ls='ls --color=always'
  75. alias lr='ls --color=always -lAR'
  76. alias lg='ls --color=always -lA | grep -i'
  77. alias zshrc='nvim ~/.zshrc'
  78. alias vim='nvim'
  79. alias cheet='curl cht.sh'
  80. alias h='htop'
  81. alias journalctl='sudo journalctl'
  82. alias agent='eval $(ssh-agent -s) && ssh-add'
  83. alias nc='ncat'
  84. alias piprq='pip install -r requirements.txt'
  85. alias son='sudo systemctl suspend'
  86. alias fucked-screen='sudo systemctl restart display-manager'
  87. alias pc4='proxychains4 -q'
  88. # Path to your oh-my-zsh installation.
  89. export ZSH="/home/katok/.oh-my-zsh"
  90. ZSH_THEME="af-magic"
  91. # Theme with collapsed pwd:
  92. # ZSH_THEME="powerlevel10k/powerlevel10k"
  93. # Uncomment the following line to use case-sensitive completion.
  94. # CASE_SENSITIVE="true"
  95. # Uncomment the following line to use hyphen-insensitive completion.
  96. # Case-sensitive completion must be off. _ and - will be interchangeable.
  97. # HYPHEN_INSENSITIVE="true"
  98. # Uncomment the following line to disable bi-weekly auto-update checks.
  99. # DISABLE_AUTO_UPDATE="true"
  100. # Uncomment the following line to automatically update without prompting.
  101. DISABLE_UPDATE_PROMPT="true"
  102. # Uncomment the following line to change how often to auto-update (in days).
  103. export UPDATE_ZSH_DAYS=13
  104. # Uncomment the following line if pasting URLs and other text is messed up.
  105. # DISABLE_MAGIC_FUNCTIONS="true"
  106. # Uncomment the following line to disable colors in ls.
  107. DISABLE_LS_COLORS="true"
  108. export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:"
  109. # Uncomment the following line to disable auto-setting terminal title.
  110. DISABLE_AUTO_TITLE="true"
  111. # Uncomment the following line to enable command auto-correction.
  112. # ENABLE_CORRECTION="true"
  113. # Uncomment the following line to display red dots whilst waiting for completion.
  114. COMPLETION_WAITING_DOTS="true"
  115. # Uncomment the following line if you want to disable marking untracked files
  116. # under VCS as dirty. This makes repository status check for large repositories
  117. # much, much faster.
  118. # DISABLE_UNTRACKED_FILES_DIRTY="true"
  119. # Uncomment the following line if you want to change the command execution time
  120. # stamp shown in the history command output.
  121. # You can set one of the optional three formats:
  122. # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
  123. # or set a custom format using the strftime function format specifications,
  124. # see 'man strftime' for details.
  125. HIST_STAMPS="dd.mm.yyyy"
  126. # Would you like to use another custom folder than $ZSH/custom?
  127. # ZSH_CUSTOM=/path/to/new-custom-folder
  128. # Which plugins would you like to load?
  129. # Standard plugins can be found in $ZSH/plugins/
  130. # Custom plugins may be added to $ZSH_CUSTOM/plugins/
  131. # Example format: plugins=(rails git textmate ruby lighthouse)
  132. # Add wisely, as too many plugins slow down shell startup.
  133. plugins=(
  134. git
  135. docker-compose
  136. docker
  137. safe-paste
  138. colored-man-pages
  139. )
  140. # User configuration
  141. #
  142. # TODO: fix according to theese example:
  143. # typeset -U path PATH
  144. # path=(~/.local/bin $path)
  145. # export PATH
  146. PATH=:~/scripts/:$PATH:$HOME/.node/bin:/opt/cuda/bin/:/home/katok/.local/share/gem/ruby/3.0.0/bin
  147. NODE_PATH="$HOME/.node/lib/node_modules:$NODE_PATH"
  148. export MANPATH="/usr/local/man:$HOME/.node/share/man:$MANPATH"
  149. export GOPATH="$HOME/go"
  150. export PATH=$PATH:$GOPATH/bin:/usr/bin
  151. PATH="/home/katok/perl5/bin${PATH:+:${PATH}}"; export PATH;
  152. # You may need to manually set your language environment
  153. # export LANG=en_US.UTF-8
  154. # Preferred editor for local and remote sessions
  155. if [[ -n $SSH_CONNECTION ]]; then
  156. export EDITOR='vim'
  157. else
  158. export EDITOR='nvim'
  159. fi
  160. # Compilation flags
  161. # export ARCHFLAGS="-arch x86_64"
  162. # Set personal aliases, overriding those provided by oh-my-zsh libs,
  163. # plugins, and themes. Aliases can be placed here, though oh-my-zsh
  164. # users are encouraged to define aliases within the ZSH_CUSTOM folder.
  165. # For a full list of active aliases, run `alias`.
  166. #
  167. # Example aliases
  168. alias zshconfig="nvim ~/.zshrc"
  169. alias vimrc="nvim ~/.vimrc"
  170. alias ohmyzsh="nvim ~/.oh-my-zsh"
  171. alias gdb="gdb -q"
  172. alias cls="clear"
  173. # ----------------------------------------
  174. PERL5LIB="/home/katok/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
  175. PERL_LOCAL_LIB_ROOT="/home/katok/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
  176. PERL_MB_OPT="--install_base \"/home/katok/perl5\""; export PERL_MB_OPT;
  177. PERL_MM_OPT="INSTALL_BASE=/home/katok/perl5"; export PERL_MM_OPT;
  178. # PYENV
  179. export PYENV_ROOT="$HOME/.pyenv"
  180. command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
  181. eval "$(pyenv init -)"
  182. # Turning on autocompletion
  183. zstyle ':completion:*:*:cp:*' file-sort size
  184. zstyle ':completion:*' file-sort modification
  185. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
  186. zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
  187. zstyle ':completion:*' rehash true # automatically find new executables in path
  188. # Speed up completions
  189. zstyle ':completion:*' accept-exact '*(N)'
  190. zstyle ':completion:*' use-cache on
  191. zstyle ':completion:*' cache-path ~/.zsh/cache
  192. # Use backgroud completion
  193. # while IFS= read -r script
  194. # do
  195. # source "$script"
  196. # done < <(find /usr/share/zsh/plugins/ -maxdepth 2 -type f -name "*.zsh" ! -name '*plugin.zsh')
  197. source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
  198. source $ZSH/oh-my-zsh.sh
  199. # set PROMPT
  200. PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%}
  201. $FG[032]%3~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} '
  202. # export ZSH_THEME_GIT_PROMPT_PREFIX=" %F{106}"
  203. # ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
  204. # ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]$bg[red]%}✖%{$reset_color%}%F{108}"
  205. # ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}%F{108}"
  206. # export PS1='%F{241}$(rvm-prompt)%F{009}⎬%{$fg_bold[green]%}%p %F{172}%c%F{161}$(git_prompt_info)%{$fg_bold[blue]%} ❯ %{$reset_color%}'