Advertisement
chaosmos

zshrc config

Feb 7th, 2023 (edited)
944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 14.97 KB | Software | 0 0
  1. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
  2. # Initialization code that may require console input (password prompts, [y/n]
  3. # confirmations, etc.) must go above this block; everything else may go below.
  4. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  5.   source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  6. fi
  7.  
  8. # If you come from bash you might have to change your $PATH.
  9. # export PATH=$HOME/bin:/usr/local/bin:$PATH
  10. export PATH=$HOME/bin:/usr/local/bin:$PATH
  11. export PATH=$HOME/chaosmos/.local/bin:$PATH
  12. export PATH=$PATH:/snap/bin/:$PATH
  13. export PATH=/usr/lib/postgresql/14/bin:$PATH
  14. export PATH="$PATH:$HOME/.local/bin"
  15. export PATH="$HOME/.npm/bin:$PATH"
  16.  
  17. export FLYCTL_INSTALL="/home/chaosmos/.fly"
  18. export PATH="$FLYCTL_INSTALL/bin:$PATH"
  19.  
  20. export GOROOT=/usr/local/go
  21. export GOPATH=$HOME/go
  22. export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  23.  
  24. # Path to your oh-my-zsh installation.
  25. export ZSH="$HOME/.oh-my-zsh"
  26.  
  27. # Set name of the theme to load --- if set to "random", it will
  28. # load a random theme each time oh-my-zsh is loaded, in which case,
  29. # to know which specific one was loaded, run: echo $RANDOM_THEME
  30. # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
  31. ZSH_THEME="powerlevel10k/powerlevel10k"
  32.  
  33. # Set list of themes to pick from when loading at random
  34. # Setting this variable when ZSH_THEME=random will cause zsh to load
  35. # a theme from this variable instead of looking in $ZSH/themes/
  36. # If set to an empty array, this variable will have no effect.
  37. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
  38.  
  39. # Uncomment the following line to use case-sensitive completion.
  40. # CASE_SENSITIVE="true"
  41.  
  42. # Uncomment the following line to use hyphen-insensitive completion.
  43. # Case-sensitive completion must be off. _ and - will be interchangeable.
  44. # HYPHEN_INSENSITIVE="true"
  45.  
  46. # Uncomment one of the following lines to change the auto-update behavior
  47. # zstyle ':omz:update' mode disabled  # disable automatic updates
  48. # zstyle ':omz:update' mode auto      # update automatically without asking
  49. # zstyle ':omz:update' mode reminder  # just remind me to update when it's time
  50.  
  51. # Uncomment the following line to change how often to auto-update (in days).
  52. zstyle ':omz:update' frequency 3
  53.  
  54. # Uncomment the following line if pasting URLs and other text is messed up.
  55. # DISABLE_MAGIC_FUNCTIONS="true"
  56.  
  57. # Uncomment the following line to disable colors in ls.
  58. # DISABLE_LS_COLORS="true"
  59.  
  60. # Uncomment the following line to disable auto-setting terminal title.
  61. # DISABLE_AUTO_TITLE="true"
  62.  
  63. # Uncomment the following line to enable command auto-correction.
  64. # ENABLE_CORRECTION="true"
  65.  
  66. # Uncomment the following line to display red dots whilst waiting for completion.
  67. # You can also set it to another string to have that shown instead of the default red dots.
  68. # e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
  69. # Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
  70. # COMPLETION_WAITING_DOTS="true"
  71.  
  72. # Uncomment the following line if you want to disable marking untracked files
  73. # under VCS as dirty. This makes repository status check for large repositories
  74. # much, much faster.
  75. # DISABLE_UNTRACKED_FILES_DIRTY="true"
  76.  
  77. # Uncomment the following line if you want to change the command execution time
  78. # stamp shown in the history command output.
  79. # You can set one of the optional three formats:
  80. # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
  81. # or set a custom format using the strftime function format specifications,
  82. # see 'man strftime' for details.
  83. # HIST_STAMPS="mm/dd/yyyy"
  84.  
  85. export HISTTIMEFORMAT="%d/%m/%y %T "
  86.  
  87. # Would you like to use another custom folder than $ZSH/custom?
  88. # ZSH_CUSTOM=/path/to/new-custom-folder
  89.  
  90. # Which plugins would you like to load?
  91. # Standard plugins can be found in $ZSH/plugins/
  92. # Custom plugins may be added to $ZSH_CUSTOM/plugins/
  93. # Example format: plugins=(rails git textmate ruby lighthouse)
  94. # Add wisely, as too many plugins slow down shell startup.
  95. plugins=(
  96.     colors
  97.     colorize
  98.     git
  99.     sudo
  100.     # zsh_reload
  101.     copypath
  102.     copyfile
  103.     command-not-found
  104.     # zsh-nvm
  105.     volta
  106.     autoupdate
  107.     zsh-autosuggestions
  108.     fd
  109.     zsh-docker-aliases
  110.     # fzf
  111.     fzf-tab
  112.     zsh-256color
  113.     # zsh-z
  114.     zoxide
  115.     npm
  116.     yarn
  117.     gulp
  118.     zsh-better-npm-completion
  119.     timer
  120.     systemd
  121.     docker
  122.     docker-compose
  123.     httpie
  124.     heroku
  125.     gh
  126.     httpie
  127.     colored-man-pages
  128.     # thefuck
  129.     F-Sy-H
  130. )
  131.  
  132. source $ZSH/oh-my-zsh.sh
  133.  
  134. # User configuration
  135.  
  136. # source $(dirname $(gem which colorls))/tab_complete.sh
  137.  
  138. #export LS_COLORS="$(vivid generate snazzy)"
  139. # export LS_COLORS="$(vivid generate molokai)"
  140. export LS_COLORS="$(vivid generate ~/.config/vivid/themes/my-custom-molokai.yml)"
  141. export MANPAGER="sh -c 'col -bx | bat -l man -p'"
  142. export FX_THEME=2
  143.  
  144. export EDITOR=micro
  145. export MICRO_TRUCOLOR=1
  146. export LANG="en_US.UTF-8"
  147. export LC_ALL="en_US.UTF-8"
  148. export COLORTERM=truecolor
  149. export FX_SHOW_SIZE=true
  150.  
  151. # source /home/chaosmos/.local/share/lscolors.sh
  152.  
  153. # export MANPATH="/usr/local/man:$MANPATH"
  154.  
  155. # You may need to manually set your language environment
  156. # export LANG=en_US.UTF-8
  157.  
  158. # Preferred editor for local and remote sessions
  159. # if [[ -n $SSH_CONNECTION ]]; then
  160. #   export EDITOR='vim'
  161. # else
  162. #   export EDITOR='mvim'
  163. # fi
  164.  
  165. # Compilation flags
  166. # export ARCHFLAGS="-arch x86_64"
  167.  
  168. # Set personal aliases, overriding those provided by oh-my-zsh libs,
  169. # plugins, and themes. Aliases can be placed here, though oh-my-zsh
  170. # users are encouraged to define aliases within the ZSH_CUSTOM folder.
  171. # For a full list of active aliases, run `alias`.
  172. #
  173. # Example aliases
  174. # alias zshconfig="mate ~/.zshrc"
  175. # alias ohmyzsh="mate ~/.oh-my-zsh"
  176.  
  177. # --------------------------------- ALIASES ---------------------------------
  178. alias d="http --download"
  179. alias reload_session="omz reload && echo the .zshrc file was updated successfully"
  180. alias sst="systemctl status"
  181. alias cp='cp -v'
  182. alias rm='rm -I'
  183. alias mv='mv -iv'
  184. alias ln='ln -sriv'
  185. alias cl="clear"
  186. alias pn="pnpm"
  187. #alias md="mkdir"
  188.  
  189. ###   FOR LS ###
  190. alias ls="exa --icons -a --git --color=always --group-directories-first"
  191. alias l="exa -l -a -h --no-user --no-permissions --icons --git --color=always --group-directories-first -@ -b --created -m"
  192. alias dis="display"
  193. # alias ls="colorls --sd -a --gs -h"
  194. alias tree="tree -I node_modules"
  195. # alias lt="ls --tree=2 -h --sd -A | grep -R --exclude-dir=node_modules"
  196. # alias lt="ls --tree=2 -h --sd -A --gs"
  197. # alias ls="lsd"
  198. # alias cd="cd && colorls --sd -a --gs -h"
  199.  
  200. ### COLORLS FOR LS ###
  201. # alias ls="colorls --sd -a --gs -h"
  202. # alias l="ls -l"
  203. # alias la="ls -a"
  204. # alias lla="ls -la"
  205. alias lt="tree -L -a -I 'node_modules|.parcel-cache|cache|.idea|.git|.github'"
  206. alias lt1="tree -L 1 -a -I 'node_modules|.parcel-cache|cache|.idea|.git|.github'"
  207. alias lt2="tree -L 2 -a -I 'node_modules|.parcel-cache|cache|.idea|.git|.github'"
  208. alias lt3="tree -L 3 -a -I 'node_modules|.parcel-cache|cache|.idea|.git|.github'"
  209. alias lt4="tree -L 4 -a -I 'node_modules|.parcel-cache|cache|.idea|.git|.github'"
  210.  
  211. alias sau="sudo apt update && sudo apt full-upgrade -y"
  212. alias sai="sudo apt install"
  213. alias fixzsh="zsh_history_fix"
  214. alias drop_cache="sudo sh -c \"echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'\""
  215. alias updzshrc="source ~/.zshrc && echo the .zshrc file was updated successfully"
  216. alias zshconfig="micro ~/.zshrc"
  217. alias ni="npm install"
  218. alias npmg="npm install --global"
  219. alias npmd="npm install --save-dev"
  220. alias mc="micro"
  221. alias debi="sudo dpkg -i"
  222. alias cat="bat"
  223.  
  224. # alias grep='grep --color=auto'
  225. # alias fgrep='fgrep --color=auto'
  226. # alias egrep='egrep --color=auto'
  227. # alias diff='diff --color=auto'
  228. alias ip='ip --color=auto'
  229. alias top='bashtop'
  230.  
  231. alias glo="forgit::log"
  232. alias gd="forgit::diff"
  233. alias ga="forgit::add"
  234.  
  235. ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#90ffc7'
  236.  
  237. FAST_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
  238.  
  239. typeset -A FAST_HIGHLIGHT_STYLES
  240.  
  241. ZSH_COLORIZE_TOOL=chroma
  242. ZSH_COLORIZE_CHROMA_FORMATTER=terminal256
  243.  
  244. # ZSH_HIGHLIGHT_STYLES[function]='fg=#3fff00'
  245. # ZSH_HIGHLIGHT_STYLES[function]='fg=#00AFFF'
  246. # ZSH_HIGHLIGHT_STYLES[builtin]='fg=#b2ffff'
  247. # ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=lightgreen,underline'
  248. # ZSH_HIGHLIGHT_STYLES[command]='fg=#00ff00'
  249. # ZSH_HIGHLIGHT_STYLES[command]='fg=#00ff00'
  250. # ZSH_HIGHLIGHT_STYLES[precommand]='fg=#00ff4c'
  251. # ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#ff6347'
  252. # ZSH_HIGHLIGHT_STYLES[path]='fg=#00AFFF'
  253. # ZSH_HIGHLIGHT_STYLES[arg0]='fg=#00FF00'
  254.  
  255. # FAST_HIGHLIGHT_STYLES[variable]='fg=#28ACB1'
  256.  
  257. FAST_HIGHLIGHT_STYLES[alias]='fg=#00ff00'
  258. FAST_HIGHLIGHT_STYLES[global-alias]='fg=#00ff00'
  259. FAST_HIGHLIGHT_STYLES[suffix-alias]='fg=#00ff00'
  260. FAST_HIGHLIGHT_STYLES[builtin]='fg=#00ff00'
  261. FAST_HIGHLIGHT_STYLES[hashed-command]='fg=#00ff00'
  262. FAST_HIGHLIGHT_STYLES[function]='fg=#00ff00'
  263. FAST_HIGHLIGHT_STYLES[command]='fg=#00ff00'
  264. FAST_HIGHLIGHT_STYLES[precommand]='fg=00ff7f'
  265.  
  266. # FAST_HIGHLIGHT_STYLES[path-to-dir]='fg=#28ACB1'
  267. FAST_HIGHLIGHT_STYLES[path-to-dir]='fg=#00ffff'
  268.  
  269. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
  270.  
  271. # fzf's command
  272. export FZF_DEFAULT_COMMAND="fd --hidden --follow --exclude '.git' --exclude 'node_modules'"
  273.  
  274. # CTRL-T's command
  275. export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND --type f"
  276.  
  277. # ALT-C's command
  278. export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND --type d"
  279.  
  280. export FZF_DEFAULT_OPTS="
  281. --layout=reverse
  282. --info=inline
  283. --height=90%
  284. --preview-window=right:60%
  285. --multi
  286. --prompt='∼ '
  287. --pointer='▶'
  288. --marker='✓'
  289. --preview '([[ -f {} ]] && (bat --style=numbers,header,grid --color=always {} || cat {})) || ([[ -d {} ]] && (exa -l -a -h --no-user --no-permissions --icons --git --color=always --group-directories-first -@ -b --created -m {} | less)) || echo {} 2> /dev/null | head -200'
  290. --bind '?:toggle-preview'
  291. --bind 'ctrl-a:select-all'
  292. --bind 'ctrl-y:execute-silent(echo {+} | pbcopy)'
  293. --bind 'ctrl-e:execute(echo {+} | xargs -o vim)'
  294. --bind 'ctrl-v:execute(code {+})'
  295. "
  296.  
  297. export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS"
  298. --color=fg:#4ca5ed,bg:#1b2b34,hl:#4cdb33
  299. --color=fg+:#00ddff,bg+:#343d46,hl+:#2bff05
  300. --color=info:#fac863,prompt:#07ed35,pointer:#07ed35
  301. --color=marker:#5fb3b3,spinner:#07ed35,header:#1fdbce
  302. "
  303.  
  304. export FORGIT_FZF_DEFAULT_OPTS="
  305. --exact
  306. --border
  307. --cycle
  308. --reverse
  309. --preview-window=bottom:80%
  310. --height '80%'
  311. "
  312.  
  313. _ZO_FZF_OPTS="
  314. --exact
  315. --border
  316. --cycle
  317. --reverse
  318. --preview 'exa -l -a -h --no-user --no-permissions --icons --git --color=always group-directories-first -@ -b $realpath'
  319. --preview-window=bottom:80%
  320. --height '80%'
  321. --layout=reverse
  322. "
  323.  
  324. zstyle ':completion::*:ls::*' fzf-completion-opts --preview='eval head {1}'
  325.  
  326. zstyle ':completion:*' fzf-search-display true
  327.  
  328. # disable sort when completing `git checkout`
  329. zstyle ':completion:*:git-checkout:*' sort false
  330. # set descriptions format to enable group support
  331. zstyle ':completion:*:descriptions' format '[%d]'
  332. # set list-colors to enable filename colorizing
  333. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  334. # preview directory's content with exa when completing cd
  335. zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -a -h --no-user --no-permissions --icons --git --color=always --group-directories-first -@ -b $realpath'
  336. zstyle ':fzf-tab:complete:<TAB>:*' fzf-preview 'exa -a -h --no-user --no-permissions --icons --git --color=always --group-directories-first -@ -b $realpath'
  337. # switch group using `,` and `.`
  338. zstyle ':fzf-tab:*' switch-group ',' '.'
  339.  
  340. zstyle ':completion:*:*:docker:*' option-stacking yes
  341. zstyle ':completion:*:*:docker-*:*' option-stacking yes
  342.  
  343. # # give a preview of commandline arguments when completing `kill`
  344. # zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
  345. # zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-preview \
  346. #   [[ $group == "[process ID]" ]] && ps --pid=$word -o cmd --no-headers -w -w'
  347. # zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-flags --preview-window=down:3:wrap'
  348.  
  349. zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word'
  350.  
  351. # it is an example. you can change it
  352. zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview \
  353.     'git diff $word | delta'
  354. zstyle ':fzf-tab:complete:git-log:*' fzf-preview \
  355.     'git log --color=always $word'
  356. zstyle ':fzf-tab:complete:git-help:*' fzf-preview \
  357.     'git help $word | bat -plman --color=always'
  358. zstyle ':fzf-tab:complete:git-show:*' fzf-preview \
  359.     'case "$group" in
  360.     "commit tag") git show --color=always $word ;;
  361.     *) git show --color=always $word | delta ;;
  362.     esac'
  363. zstyle ':fzf-tab:complete:git-checkout:*' fzf-preview \
  364.     'case "$group" in
  365.     "modified file") git diff $word | delta ;;
  366.     "recent commit object name") git show --color=always $word | delta ;;
  367.     *) git log --color=always $word ;;
  368.     esac'
  369.  
  370. _fzf_compgen_path() {
  371.   fd . "$1"
  372. }
  373.  
  374. _fzf_compgen_dir() {
  375.   fd --type d . "$1"
  376. }
  377.  
  378. [ -f ~/.oh-my-zsh/custom/plugins/forgit/forgit.plugin.zsh ] && source ~/.oh-my-zsh/custom/plugins/forgit/forgit.plugin.zsh
  379.  
  380. export LIBGL_ALWAYS_INDIRECT=1 #GWSL
  381. export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0 #GWSL
  382. export PULSE_SERVER=tcp:$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') #GWSL
  383. export QT_SCALE_FACTOR=1 #GWSL
  384.  
  385.  
  386. # export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
  387. # sudo /etc/init.d/dbus start &> /dev/null
  388. # export LIBGL_ALWAYS_INDIRECT=1
  389.  
  390. # Generated for envman. Do not edit.
  391. [ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
  392.  
  393. # Generated for envman. Do not edit.
  394. [ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
  395.  
  396. autoload -Uz compinit && compinit
  397. eval "$(zoxide init zsh)"
  398. eval "$(navi widget zsh)"
  399.  
  400. # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
  401. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
  402.  
  403. # export PATH="${PATH}:/home/chaosmos/.cargo/bin/navi"
  404.  
  405. # find-in-file - usage: fif <SEARCH_TERM>
  406. fif() {
  407.   if [ ! "$#" -gt 0 ]; then
  408.     echo "Need a string to search for!";
  409.     return 1;
  410.   fi
  411.   rg --files-with-matches --no-messages "$1" | fzf $FZF_PREVIEW_WINDOW --preview "rg --ignore-case --pretty --context 10 '$1' {}"
  412. }
  413.  
  414. # Select a docker container to start and attach to
  415. function da() {
  416.   local cid
  417.   cid=$(docker ps -a | sed 1d | fzf -1 -q "$1" | awk '{print $1}')
  418.  
  419.   [ -n "$cid" ] && docker start "$cid" && docker attach "$cid"
  420. }
  421. # Select a running docker container to stop
  422. function ds() {
  423.   local cid
  424.   cid=$(docker ps | sed 1d | fzf -q "$1" | awk '{print $1}')
  425.  
  426.   [ -n "$cid" ] && docker stop "$cid"
  427. }
  428. # Select a docker container to remove
  429. function drm() {
  430.   local cid
  431.   cid=$(docker ps -a | sed 1d | fzf -q "$1" | awk '{print $1}')
  432.  
  433.   [ -n "$cid" ] && docker rm "$cid"
  434. }
  435.  
  436. source /home/chaosmos/.config/broot/launcher/bash/br
  437.  
  438. # pnpm
  439. export PNPM_HOME="/home/chaosmos/.local/share/pnpm"
  440. export PATH="$PNPM_HOME:$PATH"
  441. # pnpm end
  442. # export VOLTA_HOME="$HOME/.volta"
  443. # export PATH="$VOLTA_HOME/bin:$PATH"
  444.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement