186 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			186 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| # Option adjustments
 | |
| unsetopt nomatch
 | |
| 
 | |
| # Swap CAPSLOCK and ESC
 | |
| setxkbmap -option caps:swapescape
 | |
| 
 | |
| # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
 | |
| # Initialization code that may require console input (password prompts, [y/n]
 | |
| # confirmations, etc.) must go above this block; everything else may go below.
 | |
| if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
 | |
|   source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
 | |
| fi
 | |
| 
 | |
| # Use powerline
 | |
| USE_POWERLINE="true"
 | |
| # Source manjaro-zsh-configuration
 | |
| if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
 | |
|   source /usr/share/zsh/manjaro-zsh-config
 | |
| fi
 | |
| 
 | |
| # Use a prompt, depending on what is available:
 | |
| #   1. starship
 | |
| #   2. p10k
 | |
| #   3. manjaro
 | |
| if (( $+commands[starship] )); then
 | |
|   eval "$(starship init zsh)"
 | |
| else
 | |
|   if [[ -s ~/.p10k.zsh ]]; then
 | |
|     source ~/.p10k.zsh
 | |
|   else
 | |
|     # Use manjaro zsh prompt
 | |
|     if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
 | |
|       source /usr/share/zsh/manjaro-zsh-prompt
 | |
|     fi
 | |
|   fi
 | |
| fi
 | |
| 
 | |
| # Autosuggestions
 | |
| if [[ -s /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
 | |
|   source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
 | |
| fi
 | |
| 
 | |
| # Intelligent and fast autojump
 | |
| if (( $+commands[zoxide] )); then
 | |
|   eval "$(zoxide init zsh)"
 | |
| fi
 | |
| 
 | |
| # Cheat my way through the CLI
 | |
| if (( $+commands[navi] )); then
 | |
|   eval "$(navi widget zsh)"
 | |
| fi
 | |
| 
 | |
| # Per-directory env
 | |
| if (( $+commands[direnv])); then
 | |
|   eval "$(direnv hook zsh)"
 | |
| fi
 | |
| 
 | |
| # Use $FINDER and $EDITOR
 | |
| if (( $+commands[$FINDER] )); then
 | |
|   e?() {
 | |
|     $EDITOR $($FINDER)
 | |
|   }
 | |
| fi
 | |
| 
 | |
| # Use fd for fzf
 | |
| if (( $+commands[fd] && $+commands[fzf] )); then
 | |
|   _fzf_compgen_path() {
 | |
|     fd --hidden --follow --exclude ".git" . "$1"
 | |
|   }
 | |
| 
 | |
|   _fzf_compgen_dir() {
 | |
|     fd --type d --hidden --follow --exclude ".git" . "$1"
 | |
|   }
 | |
| fi
 | |
| 
 | |
| # Custom aliases
 | |
| if [[ -s ~/.aliases ]]; then
 | |
|   source ~/.aliases
 | |
| fi
 | |
| if [[ -s ~/.aliases.local ]]; then
 | |
|   source ~/.aliases.local
 | |
| fi
 | |
| 
 | |
| # NVM
 | |
| if [[ -s "$NVM_DIR/nvm.sh" ]]; then
 | |
|   source "$NVM_DIR/nvm.sh"  # This loads nvm
 | |
| fi
 | |
| if [[ -s "$NVM_DIR/bash_completion" ]]; then
 | |
|   source "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
 | |
| fi
 | |
| 
 | |
| # Virtualenvwrapper
 | |
| if [[ -s "$HOME/.local/bin/virtualenvwrapper_lazy.sh" ]]; then
 | |
|   source "$HOME/.local/bin/virtualenvwrapper_lazy.sh"
 | |
| elif [[ -s "$HOME/.local/bin/virtualenvwrapper.sh" ]]; then
 | |
|   source "$HOME/.local/bin/virtualenvwrapper.sh"
 | |
| fi
 | |
| 
 | |
| # broot
 | |
| if [[ -s ~/.config/broot/launcher/bash/br ]]; then
 | |
|   source ~/.config/broot/launcher/bash/br
 | |
| fi
 | |
| 
 | |
| # zellij
 | |
| if (( $+commands[zellij] )); then
 | |
|   ZELLIJ_AUTO_ATTACH=true
 | |
|   eval "$(zellij setup --generate-auto-start zsh)"
 | |
| 
 | |
|   ide() {
 | |
|     local layout="${ZELLIJ_LAYOUT:-${HOME}/.config/zellij/layouts/project.kdl}"
 | |
|     local name="${PWD##*/}"
 | |
|     local name="${name:-/}"
 | |
| 
 | |
|     if (( ${+ZELLIJ} )); then
 | |
|       zellij action new-tab --layout "${layout}" --cwd "${PWD}" --name "${name}"
 | |
|     else
 | |
|       zellij --layout "${layout}" $@
 | |
|     fi
 | |
|   }
 | |
| fi
 | |
| 
 | |
| # exa
 | |
| if (( $+commands[exa] )); then
 | |
|   # exa explorer
 | |
|   exex() {
 | |
|     local depth=1
 | |
|     local old_depth=0
 | |
|     local min_depth=1
 | |
|     local max_depth=3
 | |
|     local exa_opts=("--color=always" "--git" "--icons" "-F" "-T")
 | |
| 
 | |
|     while true; do
 | |
|       if [[ $depth -ne $old_depth ]]; then
 | |
|         local old_depth=$depth
 | |
|         clear
 | |
|         exa $exa_opts -L$depth
 | |
|       fi 
 | |
| 
 | |
|       read -sk key
 | |
| 
 | |
|       case $key in
 | |
|       h)
 | |
|         [[ $depth -gt $min_depth ]] && (( depth-- ))
 | |
|         ;;
 | |
|       l)
 | |
|         [[ $depth -lt $max_depth ]] && (( depth++ ))
 | |
|         ;;
 | |
|       q)
 | |
|         break
 | |
|         ;;
 | |
|       esac
 | |
|     done
 | |
|   }
 | |
| fi
 | |
| 
 | |
| # git
 | |
| if (( $+commands[git] )); then
 | |
|   git_chpwd_hook() {
 | |
|     if [[ -d ".git" ]]; then
 | |
|       git status
 | |
|     fi
 | |
|   }
 | |
| 
 | |
|   chpwd_functions+=( git_chpwd_hook )
 | |
| 
 | |
|   git_chpwd_hook
 | |
| fi
 | |
| 
 | |
| # gh
 | |
| if (( $+commands[gh] )); then
 | |
|   gh_chpwd_hook() {
 | |
|     if [[ -d ".github" ]]; then
 | |
|       gh pr list
 | |
|     fi
 | |
|   }
 | |
| 
 | |
|   chpwd_functions+=( gh_chpwd_hook )
 | |
| 
 | |
|   gh_chpwd_hook
 | |
| fi
 | |
| 
 | |
| # Source machine-specific setup
 | |
| if [[ -s ~/.zshrc.local ]]; then
 | |
|   source ~/.zshrc.local
 | |
| fi
 |