118 lines
3.9 KiB
Bash
118 lines
3.9 KiB
Bash
# 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
|
|
|
|
# Set the directory where we want to store zinit and plugins
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
|
|
|
# Download zinit if not present
|
|
if [ ! -d $ZINIT_HOME ]; then
|
|
mkdir -p "$(dirname $ZINIT_HOME)"
|
|
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
fi
|
|
|
|
# Load zinit
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
|
|
# Add in Powerlevel10k
|
|
zinit ice depth=1; zinit light romkatv/powerlevel10k
|
|
|
|
# Add in zsh plugins
|
|
zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-completions
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
zinit light Aloxaf/fzf-tab
|
|
|
|
# Add in snippets (omz plugins)
|
|
zinit snippet OMZP::git
|
|
zinit snippet OMZP::archlinux
|
|
zinit snippet OMZP::sudo
|
|
#zinit snippet OMZP::command-not-found
|
|
|
|
#zinit snippet OMZP::kubectl
|
|
#zinit snippet OMZP::kubectx
|
|
|
|
# Load completions
|
|
autoload -U compinit && compinit
|
|
|
|
zinit cdreplay -q # Optimize cache (recommended by the zinit doc)
|
|
|
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
|
|
|
# Keybindings
|
|
bindkey -e # Use emacs keybindings
|
|
bindkey '^p' history-search-backward
|
|
bindkey '^n' history-search-forward
|
|
bindkey '^[[3~' delete-char # Makes the delete key work properly
|
|
bindkey '^[[3;5~' kill-word # Makes the delete key work properly
|
|
# Missing ctrl+delete
|
|
bindkey "^[[1;5C" forward-word # Same with M-arrows
|
|
bindkey "^[[1;5D" backward-word
|
|
|
|
# History
|
|
HISTSIZE=5000
|
|
HISTFILE=~/.zsh_hist
|
|
SAVEHIST=$HISTSIZE
|
|
setopt appendhistory
|
|
setopt sharehistory
|
|
setopt hist_ignore_space
|
|
# The following lines concerns history duplicates
|
|
# They're disabled as I prefer having a real history of my commands
|
|
#HISTDUP=erase
|
|
#setopt hist_ignore_all_dups
|
|
#setopt hist_ignore_dups
|
|
#setopt hist_find_no_dups
|
|
|
|
# Completions styling
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' # Makes completions case insensitive
|
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Makes completions colored
|
|
zstyle ':completion:*' menu no # Hide the default completions menu (replaced by fzf)
|
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
|
setopt correct # 'Did you mean'
|
|
|
|
# Environment variables
|
|
export PATH=$PATH:~/.local/bin
|
|
export PATH=$PATH:~/.local/share/Xilinx/Vivado/2024.2/bin
|
|
export EDITOR=nvim
|
|
|
|
# Aliases
|
|
alias cl='clear'
|
|
alias hyprcfg='vim ~/.config/hypr/'
|
|
alias zcfg='$EDITOR ~/.zshrc'
|
|
alias icat='kitten icat'
|
|
alias nv='nvim'
|
|
alias hx='helix'
|
|
alias cg='cargo'
|
|
alias rqr='rust-quick-run.sh'
|
|
alias vm='quickemu --vm *.conf'
|
|
# Power management
|
|
alias pprof='cat /sys/firmware/acpi/platform_profile' # Get current performance profile
|
|
alias pprof-list='cat /sys/firmware/acpi/platform_profile_choices' # Lists the available performance profiles
|
|
alias power-draw="cat /sys/class/power_supply/BAT1/current_now /sys/class/power_supply/BAT1/voltage_now | xargs | awk '{print \$1*\$2/1e12 \" W\"}\'"
|
|
alias battery='cat /sys/class/power_supply/BAT1/capacity'
|
|
# Override some default commands with more practical alternatives
|
|
# Note: default ls command is still accessible with '\ls'
|
|
alias ls='eza --icons=automatic --tree --level=1 --follow-symlinks --no-quotes '
|
|
alias lsa='ls -a'
|
|
alias lsl='eza --icons=automatic --long --header --group -M'
|
|
alias tree='ls --level=3'
|
|
# Random stuff
|
|
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
|
|
alias sshfs="sshfs -o follow_symlinks"
|
|
|
|
# Shell integrations
|
|
eval "$(fzf --zsh)"
|
|
eval "$(zoxide init --cmd cd zsh)" # Override cd with zoxide
|
|
|
|
# pnpm
|
|
export PNPM_HOME="/home/guillm/.local/share/pnpm"
|
|
case ":$PATH:" in
|
|
*":$PNPM_HOME:"*) ;;
|
|
*) export PATH="$PNPM_HOME:$PATH" ;;
|
|
esac
|
|
# pnpm end
|