update HyDE
This commit is contained in:
1826
.config/zsh/.p10k.zsh
Normal file
1826
.config/zsh/.p10k.zsh
Normal file
File diff suppressed because it is too large
Load Diff
1919
.config/zsh/.zcompdump
Normal file
1919
.config/zsh/.zcompdump
Normal file
File diff suppressed because it is too large
Load Diff
1922
.config/zsh/.zcompdump-anid-5.9
Normal file
1922
.config/zsh/.zcompdump-anid-5.9
Normal file
File diff suppressed because it is too large
Load Diff
BIN
.config/zsh/.zcompdump-anid-5.9.zwc
Normal file
BIN
.config/zsh/.zcompdump-anid-5.9.zwc
Normal file
Binary file not shown.
2007
.config/zsh/.zsh_history
Normal file
2007
.config/zsh/.zsh_history
Normal file
File diff suppressed because it is too large
Load Diff
16
.config/zsh/.zshenv
Normal file
16
.config/zsh/.zshenv
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#! ██████╗░░█████╗░ ███╗░░██╗░█████╗░████████╗ ███████╗██████╗░██╗████████╗
|
||||
#! ██╔══██╗██╔══██╗ ████╗░██║██╔══██╗╚══██╔══╝ ██╔════╝██╔══██╗██║╚══██╔══╝
|
||||
#! ██║░░██║██║░░██║ ██╔██╗██║██║░░██║░░░██║░░░ █████╗░░██║░░██║██║░░░██║░░░
|
||||
#! ██║░░██║██║░░██║ ██║╚████║██║░░██║░░░██║░░░ ██╔══╝░░██║░░██║██║░░░██║░░░
|
||||
#! ██████╔╝╚█████╔╝ ██║░╚███║╚█████╔╝░░░██║░░░ ███████╗██████╔╝██║░░░██║░░░
|
||||
#! ╚═════╝░░╚════╝░ ╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░ ╚══════╝╚═════╝░╚═╝░░░╚═╝░░░
|
||||
|
||||
# Load all custom module files // Directories are ignored
|
||||
# As Directories are ignored, we can store a bunch of boilerplate script in a ``./conf.d/custom-directory``
|
||||
# then we can make an entry point script: `./conf.d/custom-directory.zsh`managing all the files in that directory
|
||||
|
||||
for file in "${ZDOTDIR:-$HOME/.config/zsh}/conf.d/"*.zsh; do
|
||||
[ -r "$file" ] && source "$file"
|
||||
done
|
94
.config/zsh/.zshrc
Normal file
94
.config/zsh/.zshrc
Normal file
@@ -0,0 +1,94 @@
|
||||
# Add user configurations here
|
||||
# For HyDE to not touch your beloved configurations,
|
||||
# we added a config file for you to customize HyDE before loading zshrc
|
||||
# Edit $ZDOTDIR/.user.zsh to customize HyDE before loading zshrc
|
||||
|
||||
# Plugins
|
||||
# oh-my-zsh plugins are loaded in $ZDOTDIR/.user.zsh file, see the file for more information
|
||||
|
||||
# Aliases
|
||||
# Override aliases here in '$ZDOTDIR/.zshrc' (already set in .zshenv)
|
||||
|
||||
# # Helpful aliases
|
||||
# alias c='clear' # clear terminal
|
||||
# alias l='eza -lh --icons=auto' # long list
|
||||
# alias ls='eza -1 --icons=auto' # short list
|
||||
# alias ll='eza -lha --icons=auto --sort=name --group-directories-first' # long list all
|
||||
# alias ld='eza -lhD --icons=auto' # long list dirs
|
||||
# alias lt='eza --icons=auto --tree' # list folder as tree
|
||||
# alias un='$aurhelper -Rns' # uninstall package
|
||||
# alias up='$aurhelper -Syu' # update system/package/aur
|
||||
# alias pl='$aurhelper -Qs' # list installed package
|
||||
# alias pa='$aurhelper -Ss' # list available package
|
||||
alias pc='$aurhelper -Sc' # remove unused cache
|
||||
alias po='$aurhelper -Qtdq | $aurhelper -Rns -' # remove unused packages, also try > $aurhelper -Qqd | $aurhelper -Rsu --print -
|
||||
# alias vc='code' # gui code editor
|
||||
# alias fastfetch='fastfetch --logo-type kitty'
|
||||
alias l='eza -1h --icons=auto --sort=name --group-directories-first' # long list
|
||||
alias ls='eza -l --icons=auto --sort=name --group-directories-first' # short list
|
||||
alias ll='eza -lha --icons=auto --sort=name --group-directories-first' # long list all
|
||||
alias дд='eza -lha --icons=auto --sort=name --group-directories-first' # sometimes i forget to change keyboard layout
|
||||
|
||||
|
||||
# # Directory navigation shortcuts
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias .3='cd ../../..'
|
||||
alias .4='cd ../../../..'
|
||||
alias .5='cd ../../../../..'
|
||||
|
||||
# # Always mkdir a path (this doesn't inhibit functionality to make a single dir)
|
||||
alias mkdir='mkdir -p'
|
||||
|
||||
# This is your file
|
||||
# Add your configurations here
|
||||
export EDITOR=nvim
|
||||
#export EDITOR=code
|
||||
|
||||
# unset -f command_not_found_handler # Uncomment to prevent searching for commands not found in package manager
|
||||
#
|
||||
|
||||
# My own helpful aliases
|
||||
alias icat='kitten icat' # display images in terminal
|
||||
alias ssh='kitten ssh' # functional ssh with kitty
|
||||
alias snv='sudo -E nvim' # sudo nvim
|
||||
alias nv='nvim'
|
||||
alias pi='ssh omoelle'
|
||||
alias pi-mount='sshfs omoelle:/home/elleoma ~/mnt && cd ~/mnt'
|
||||
alias wifi="nmcli d wifi show-password | grep 'Password' | awk -F': ' '{ print \$2 }'"
|
||||
alias pivpn="wg-quick up laptop"
|
||||
alias config='git --git-dir=/home/elleoma/.config --work-tree=/home/elleoma'
|
||||
|
||||
# git aliases
|
||||
alias gs='git status '
|
||||
alias ga='git add '
|
||||
alias gb='git branch '
|
||||
alias gc='git commit'
|
||||
alias gd='git diff'
|
||||
alias gco='git checkout '
|
||||
alias gk='gitk --all&'
|
||||
alias gx='gitx --all'
|
||||
alias got='git '
|
||||
alias get='git '
|
||||
alias gut='git '
|
||||
|
||||
# Syntax highlighting for man pages
|
||||
export MANPAGER='nvim +Man!'
|
||||
|
||||
# Setting Ruby path
|
||||
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
|
||||
export PATH="$PATH:$GEM_HOME/bin"
|
||||
|
||||
# Created by `pipx` on 2025-02-01 15:08:39
|
||||
export PATH="$PATH:/home/elleoma/.local/bin"
|
||||
|
||||
# Setting up Rust
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
|
||||
export SDKMAN_DIR="$HOME/.sdkman"
|
||||
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
export PATH=~/.npm-global/bin:$PATH
|
||||
|
||||
# go binaries path
|
||||
export PATH=~/go/bin:$PATH
|
4
.config/zsh/completions/fzf.zsh
Normal file
4
.config/zsh/completions/fzf.zsh
Normal file
@@ -0,0 +1,4 @@
|
||||
# Ctrl-R fzf completio
|
||||
if command -v fzf &>/dev/null; then
|
||||
eval "$(fzf --zsh)"
|
||||
fi
|
5
.config/zsh/completions/hydectl.zsh
Normal file
5
.config/zsh/completions/hydectl.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
# hydectl tab completion
|
||||
if command -v hydectl &>/dev/null; then
|
||||
compdef _hydectl hydectl
|
||||
eval "$(hydectl completion zsh)"
|
||||
fi
|
20
.config/zsh/conf.d/00-hyde.zsh
Normal file
20
.config/zsh/conf.d/00-hyde.zsh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#! ██████╗░░█████╗░ ███╗░░██╗░█████╗░████████╗ ███████╗██████╗░██╗████████╗
|
||||
#! ██╔══██╗██╔══██╗ ████╗░██║██╔══██╗╚══██╔══╝ ██╔════╝██╔══██╗██║╚══██╔══╝
|
||||
#! ██║░░██║██║░░██║ ██╔██╗██║██║░░██║░░░██║░░░ █████╗░░██║░░██║██║░░░██║░░░
|
||||
#! ██║░░██║██║░░██║ ██║╚████║██║░░██║░░░██║░░░ ██╔══╝░░██║░░██║██║░░░██║░░░
|
||||
#! ██████╔╝╚█████╔╝ ██║░╚███║╚█████╔╝░░░██║░░░ ███████╗██████╔╝██║░░░██║░░░
|
||||
#! ╚═════╝░░╚════╝░ ╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░ ╚══════╝╚═════╝░╚═╝░░░╚═╝░░░
|
||||
|
||||
|
||||
# Sources vital global environment variables and configurations // Users are encouraged to use ./user.zsh for customization
|
||||
# shellcheck disable=SC1091
|
||||
if ! . "$ZDOTDIR/conf.d/hyde/env.zsh"; then
|
||||
echo "Error: Could not source $ZDOTDIR/conf.d/hyde/env.zsh"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -t 1 ] && [ -f "$ZDOTDIR/conf.d/hyde/terminal.zsh" ]; then
|
||||
. "$ZDOTDIR/conf.d/hyde/terminal.zsh" || echo "Error: Could not source $ZDOTDIR/conf.d/hyde/terminal.zsh"
|
||||
fi
|
47
.config/zsh/conf.d/hyde/env.zsh
Normal file
47
.config/zsh/conf.d/hyde/env.zsh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#! ██████╗░░█████╗░ ███╗░░██╗░█████╗░████████╗ ███████╗██████╗░██╗████████╗
|
||||
#! ██╔══██╗██╔══██╗ ████╗░██║██╔══██╗╚══██╔══╝ ██╔════╝██╔══██╗██║╚══██╔══╝
|
||||
#! ██║░░██║██║░░██║ ██╔██╗██║██║░░██║░░░██║░░░ █████╗░░██║░░██║██║░░░██║░░░
|
||||
#! ██║░░██║██║░░██║ ██║╚████║██║░░██║░░░██║░░░ ██╔══╝░░██║░░██║██║░░░██║░░░
|
||||
#! ██████╔╝╚█████╔╝ ██║░╚███║╚█████╔╝░░░██║░░░ ███████╗██████╔╝██║░░░██║░░░
|
||||
#! ╚═════╝░░╚════╝░ ╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░ ╚══════╝╚═════╝░╚═╝░░░╚═╝░░░
|
||||
|
||||
# Hyde's Shell Environment Initialization Script
|
||||
# If users used UWSM, uwsm will override any variables set anywhere in you shell configurations
|
||||
|
||||
# Basic PATH prepending (user local bin)
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
# XDG Base Directory Specification variables with defaults
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
XDG_DATA_DIRS="${XDG_DATA_DIRS:-$XDG_DATA_HOME:/usr/local/share:/usr/share}"
|
||||
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
|
||||
# XDG User Directories (fallback to xdg-user-dir command if available)
|
||||
if command -v xdg-user-dir >/dev/null 2>&1; then
|
||||
XDG_DESKTOP_DIR="${XDG_DESKTOP_DIR:-$(xdg-user-dir DESKTOP)}"
|
||||
XDG_DOWNLOAD_DIR="${XDG_DOWNLOAD_DIR:-$(xdg-user-dir DOWNLOAD)}"
|
||||
XDG_TEMPLATES_DIR="${XDG_TEMPLATES_DIR:-$(xdg-user-dir TEMPLATES)}"
|
||||
XDG_PUBLICSHARE_DIR="${XDG_PUBLICSHARE_DIR:-$(xdg-user-dir PUBLICSHARE)}"
|
||||
XDG_DOCUMENTS_DIR="${XDG_DOCUMENTS_DIR:-$(xdg-user-dir DOCUMENTS)}"
|
||||
XDG_MUSIC_DIR="${XDG_MUSIC_DIR:-$(xdg-user-dir MUSIC)}"
|
||||
XDG_PICTURES_DIR="${XDG_PICTURES_DIR:-$(xdg-user-dir PICTURES)}"
|
||||
XDG_VIDEOS_DIR="${XDG_VIDEOS_DIR:-$(xdg-user-dir VIDEOS)}"
|
||||
fi
|
||||
|
||||
# Less history file location
|
||||
LESSHISTFILE="${LESSHISTFILE:-/tmp/less-hist}"
|
||||
|
||||
# Application config files
|
||||
PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
|
||||
SCREENRC="$XDG_CONFIG_HOME/screen/screenrc"
|
||||
|
||||
# Export all variables
|
||||
export PATH \
|
||||
XDG_CONFIG_HOME XDG_DATA_HOME XDG_DATA_DIRS XDG_STATE_HOME XDG_CACHE_HOME \
|
||||
XDG_DESKTOP_DIR XDG_DOWNLOAD_DIR XDG_TEMPLATES_DIR XDG_PUBLICSHARE_DIR \
|
||||
XDG_DOCUMENTS_DIR XDG_MUSIC_DIR XDG_PICTURES_DIR XDG_VIDEOS_DIR \
|
||||
LESSHISTFILE PARALLEL_HOME SCREENRC
|
36
.config/zsh/conf.d/hyde/prompt.zsh
Normal file
36
.config/zsh/conf.d/hyde/prompt.zsh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#! ██████╗░░█████╗░ ███╗░░██╗░█████╗░████████╗ ███████╗██████╗░██╗████████╗
|
||||
#! ██╔══██╗██╔══██╗ ████╗░██║██╔══██╗╚══██╔══╝ ██╔════╝██╔══██╗██║╚══██╔══╝
|
||||
#! ██║░░██║██║░░██║ ██╔██╗██║██║░░██║░░░██║░░░ █████╗░░██║░░██║██║░░░██║░░░
|
||||
#! ██║░░██║██║░░██║ ██║╚████║██║░░██║░░░██║░░░ ██╔══╝░░██║░░██║██║░░░██║░░░
|
||||
#! ██████╔╝╚█████╔╝ ██║░╚███║╚█████╔╝░░░██║░░░ ███████╗██████╔╝██║░░░██║░░░
|
||||
#! ╚═════╝░░╚════╝░ ╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░ ╚══════╝╚═════╝░╚═╝░░░╚═╝░░░
|
||||
|
||||
# Let HyDE immediately load prompts
|
||||
# For now supported prompts are Starship and Powerlevel10k (p10k)
|
||||
|
||||
# Exit early if HYDE_ZSH_PROMPT is not set to 1
|
||||
if [[ "${HYDE_ZSH_PROMPT}" != "1" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if command -v starship &>/dev/null; then
|
||||
# ===== START Initialize Starship prompt =====
|
||||
eval "$(starship init zsh)"
|
||||
export STARSHIP_CACHE=$XDG_CACHE_HOME/starship
|
||||
export STARSHIP_CONFIG=$XDG_CONFIG_HOME/starship/starship.toml
|
||||
# ===== END Initialize Starship prompt =====
|
||||
elif [ -r $HOME/.p10k.zsh ] || [ -r $ZDOTDIR/.p10k.zsh ]; then
|
||||
# ===== START Initialize Powerlevel10k theme =====
|
||||
POWERLEVEL10K_TRANSIENT_PROMPT=same-dir
|
||||
P10k_THEME=${P10k_THEME:-/usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme}
|
||||
[[ -r $P10k_THEME ]] && source $P10k_THEME
|
||||
# To customize prompt, run `p10k configure` or edit $HOME/.p10k.zsh
|
||||
if [[ -f $HOME/.p10k.zsh ]]; then
|
||||
source $HOME/.p10k.zsh
|
||||
elif [[ -f $ZDOTDIR/.p10k.zsh ]]; then
|
||||
source $ZDOTDIR/.p10k.zsh
|
||||
fi
|
||||
# ===== END Initialize Powerlevel10k theme =====
|
||||
fi
|
224
.config/zsh/conf.d/hyde/terminal.zsh
Normal file
224
.config/zsh/conf.d/hyde/terminal.zsh
Normal file
@@ -0,0 +1,224 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#! ██████╗░░█████╗░ ███╗░░██╗░█████╗░████████╗ ███████╗██████╗░██╗████████╗
|
||||
#! ██╔══██╗██╔══██╗ ████╗░██║██╔══██╗╚══██╔══╝ ██╔════╝██╔══██╗██║╚══██╔══╝
|
||||
#! ██║░░██║██║░░██║ ██╔██╗██║██║░░██║░░░██║░░░ █████╗░░██║░░██║██║░░░██║░░░
|
||||
#! ██║░░██║██║░░██║ ██║╚████║██║░░██║░░░██║░░░ ██╔══╝░░██║░░██║██║░░░██║░░░
|
||||
#! ██████╔╝╚█████╔╝ ██║░╚███║╚█████╔╝░░░██║░░░ ███████╗██████╔╝██║░░░██║░░░
|
||||
#! ╚═════╝░░╚════╝░ ╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░ ╚══════╝╚═════╝░╚═╝░░░╚═╝░░░
|
||||
|
||||
# HyDE's ZSH env configuration
|
||||
# This file is sourced by ZSH on startup
|
||||
# And ensures that we have an obstruction-free .zshrc file
|
||||
# This also ensures that the proper HyDE $ENVs are loaded
|
||||
|
||||
function _load_common() {
|
||||
|
||||
# Load all custom function files // Directories are ignored
|
||||
for file in "${ZDOTDIR:-$HOME/.config/zsh}/functions/"*.zsh; do
|
||||
[ -r "$file" ] && source "$file"
|
||||
done
|
||||
|
||||
for file in "${ZDOTDIR:-$HOME/.config/zsh}/completions/"*.zsh; do
|
||||
[ -r "$file" ] && source "$file"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
function _dedup_zsh_plugins {
|
||||
unset -f _dedup_zsh_plugins
|
||||
# Oh-my-zsh installation path
|
||||
zsh_paths=(
|
||||
"$HOME/.oh-my-zsh"
|
||||
"/usr/local/share/oh-my-zsh"
|
||||
"/usr/share/oh-my-zsh"
|
||||
)
|
||||
for zsh_path in "${zsh_paths[@]}"; do [[ -d $zsh_path ]] && export ZSH=$zsh_path && break; done
|
||||
# Load Plugins
|
||||
hyde_plugins=(git zsh-256color zsh-autosuggestions zsh-syntax-highlighting)
|
||||
plugins+=("${plugins[@]}" "${hyde_plugins[@]}")
|
||||
# Deduplicate plugins
|
||||
plugins=("${plugins[@]}")
|
||||
plugins=($(printf "%s\n" "${plugins[@]}" | sort -u))
|
||||
# Defer oh-my-zsh loading until after prompt appears
|
||||
typeset -g DEFER_OMZ_LOAD=1
|
||||
}
|
||||
|
||||
function _defer_omz_after_prompt_before_input() {
|
||||
|
||||
[[ -r $ZSH/oh-my-zsh.sh ]] && source $ZSH/oh-my-zsh.sh
|
||||
#! Never load time consuming functions here
|
||||
|
||||
# Add your completions directory to fpath
|
||||
fpath=($ZDOTDIR/completions "${fpath[@]}")
|
||||
|
||||
_load_compinit
|
||||
|
||||
_load_common
|
||||
|
||||
# zsh-autosuggestions won't work on first prompt when deferred
|
||||
if typeset -f _zsh_autosuggest_start >/dev/null; then
|
||||
_zsh_autosuggest_start
|
||||
fi
|
||||
|
||||
chmod +r $ZDOTDIR/.zshrc # Make sure .zshrc is readable
|
||||
[[ -r $ZDOTDIR/.zshrc ]] && source $ZDOTDIR/.zshrc
|
||||
}
|
||||
|
||||
function _load_deferred_plugin_system_by_hyde() {
|
||||
|
||||
# Exit early if HYDE_ZSH_DEFER is not set to 1
|
||||
if [[ "${HYDE_ZSH_DEFER}" != "1" ]]; then
|
||||
unset -f _load_deferred_plugin_system_by_hyde
|
||||
return
|
||||
fi
|
||||
|
||||
# Defer oh-my-zsh loading until after prompt appears
|
||||
# Load oh-my-zsh when line editor initializes // before user input
|
||||
if [[ -n $DEFER_OMZ_LOAD ]]; then
|
||||
unset DEFER_OMZ_LOAD
|
||||
[[ ${VSCODE_INJECTION} == 1 ]] || chmod -r $ZDOTDIR/.zshrc # let vscode read .zshrc
|
||||
zle -N zle-line-init _defer_omz_after_prompt_before_input # Loads when the line editor initializes // The best option
|
||||
fi
|
||||
# Below this line are the commands that are executed after the prompt appears
|
||||
|
||||
# autoload -Uz add-zsh-hook
|
||||
# add-zsh-hook zshaddhistory load_omz_deferred # loads after the first command is added to history
|
||||
# add-zsh-hook precmd load_omz_deferred # Loads when shell is ready to accept commands
|
||||
# add-zsh-hook preexec load_omz_deferred # Loads before the first command executes
|
||||
|
||||
# TODO: add handlers in pm.sh
|
||||
# for these aliases please manually add the following lines to your .zshrc file.(Using yay as the aur helper)
|
||||
# pc='yay -Sc' # remove all cached packages
|
||||
# po='yay -Qtdq | ${PM_COMMAND[@]} -Rns -' # remove orphaned packages
|
||||
|
||||
# zsh-autosuggestions won't work on first prompt when deferred
|
||||
if typeset -f _zsh_autosuggest_start >/dev/null; then
|
||||
_zsh_autosuggest_start
|
||||
fi
|
||||
|
||||
# Some binds won't work on first prompt when deferred
|
||||
bindkey '\e[H' beginning-of-line
|
||||
bindkey '\e[F' end-of-line
|
||||
|
||||
}
|
||||
|
||||
function do_render {
|
||||
# Check if the terminal supports images
|
||||
local type="${1:-image}"
|
||||
# TODO: update this list if needed
|
||||
TERMINAL_IMAGE_SUPPORT=(kitty konsole ghostty WezTerm)
|
||||
local terminal_no_art=(vscode code codium)
|
||||
TERMINAL_NO_ART="${TERMINAL_NO_ART:-${terminal_no_art[@]}}"
|
||||
CURRENT_TERMINAL="${TERM_PROGRAM:-$(ps -o comm= -p $(ps -o ppid= -p $$))}"
|
||||
|
||||
case "${type}" in
|
||||
image)
|
||||
if [[ " ${TERMINAL_IMAGE_SUPPORT[@]} " =~ " ${CURRENT_TERMINAL} " ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
art)
|
||||
if [[ " ${TERMINAL_NO_ART[@]} " =~ " ${CURRENT_TERMINAL} " ]]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _load_compinit() {
|
||||
# Initialize completions with optimized performance
|
||||
autoload -Uz compinit
|
||||
|
||||
# Enable extended glob for the qualifier to work
|
||||
setopt EXTENDED_GLOB
|
||||
|
||||
# Fastest - use glob qualifiers on directory pattern
|
||||
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+${HYDE_ZSH_COMPINIT_CHECK:-1}) ]]; then
|
||||
compinit
|
||||
else
|
||||
compinit -C
|
||||
fi
|
||||
|
||||
_comp_options+=(globdots) # tab complete hidden files
|
||||
}
|
||||
|
||||
function _load_prompt() {
|
||||
# Try to load prompts immediately
|
||||
if ! source ${ZDOTDIR}/prompt.zsh > /dev/null 2>&1; then
|
||||
[[ -f $ZDOTDIR/conf.d/hyde/prompt.zsh ]] && source $ZDOTDIR/conf.d/hyde/prompt.zsh
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#? Override this environment variable in ~/.zshrc
|
||||
# cleaning up home folder
|
||||
# ZSH Plugin Configuration
|
||||
|
||||
HYDE_ZSH_DEFER="1" #Unset this variable in $ZDOTDIR/user.zsh to disable HyDE's deferred Zsh loading.
|
||||
HYDE_ZSH_PROMPT="1" #Unset this variable in $ZDOTDIR/user.zsh to disable HyDE's prompt customization.
|
||||
HYDE_ZSH_NO_PLUGINS="1" #Unset this variable in $ZDOTDIR/user.zsh to disable HyDE's deferred Zsh loading.
|
||||
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
|
||||
# # History configuration
|
||||
HISTFILE=${HISTFILE:-$ZDOTDIR/.zsh_history}
|
||||
if [[ -f $HOME/.zsh_history ]] && [[ ! -f $HISTFILE ]]; then
|
||||
echo "Please manually move $HOME/.zsh_history to $HISTFILE"
|
||||
echo "Or move it somewhere else to avoid conflicts"
|
||||
fi
|
||||
|
||||
export HISTFILE ZSH_AUTOSUGGEST_STRATEGY
|
||||
|
||||
# HyDE Package Manager
|
||||
PM_COMMAND=(hyde-shell pm)
|
||||
|
||||
# Optionally load user configuration // useful for customizing the shell without modifying the main file
|
||||
if [[ -f $HOME/.hyde.zshrc ]]; then
|
||||
source $HOME/.hyde.zshrc # for backward compatibility
|
||||
elif [[ -f $HOME/.user.zsh ]]; then
|
||||
source $HOME/.user.zsh # renamed to .user.zsh for intuitiveness that it is a user config
|
||||
elif [[ -f $ZDOTDIR/user.zsh ]]; then
|
||||
source $ZDOTDIR/user.zsh
|
||||
fi
|
||||
|
||||
_load_compinit
|
||||
|
||||
|
||||
if [[ ${HYDE_ZSH_NO_PLUGINS} == "1" ]]; then
|
||||
# Deduplicate omz plugins()
|
||||
_dedup_zsh_plugins
|
||||
|
||||
if [[ "$HYDE_ZSH_OMZ_DEFER" == "1" ]]; then
|
||||
_load_deferred_plugin_system_by_hyde
|
||||
_load_prompt # This disables transient prompts sadly
|
||||
else
|
||||
[[ -r $ZSH/oh-my-zsh.sh ]] && source $ZSH/oh-my-zsh.sh
|
||||
_load_prompt
|
||||
_load_common
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
alias c='clear' \
|
||||
in='${PM_COMMAND[@]} install' \
|
||||
un='${PM_COMMAND[@]} remove' \
|
||||
up='${PM_COMMAND[@]} upgrade' \
|
||||
pl='${PM_COMMAND[@]} search installed' \
|
||||
pa='${PM_COMMAND[@]} search all' \
|
||||
vc='code' \
|
||||
fastfetch='fastfetch --logo-type kitty' \
|
||||
..='cd ..' \
|
||||
...='cd ../..' \
|
||||
.3='cd ../../..' \
|
||||
.4='cd ../../../..' \
|
||||
.5='cd ../../../../..' \
|
||||
mkdir='mkdir -p'
|
5
.config/zsh/functions/bat.zsh
Normal file
5
.config/zsh/functions/bat.zsh
Normal file
@@ -0,0 +1,5 @@
|
||||
if command -v "bat" &>/dev/null; then
|
||||
alias -g -- -h='-h 2>&1 | bat --language=help --style=plain --paging=never --color always'
|
||||
alias -g -- --help='--help 2>&1 | bat --language=help --style=plain --paging=never --color always'
|
||||
alias cat='bat --style=plain --paging=never --color auto'
|
||||
fi
|
77
.config/zsh/functions/error-handlers.zsh
Normal file
77
.config/zsh/functions/error-handlers.zsh
Normal file
@@ -0,0 +1,77 @@
|
||||
function command_not_found_handler {
|
||||
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
|
||||
printf "${green}zsh${reset}: command ${purple}NOT${reset} found: ${bright}'%s'${reset}\n" "$1"
|
||||
|
||||
if ! ${PM_COMMAND[@]} -h &>/dev/null; then
|
||||
return 127
|
||||
fi
|
||||
|
||||
printf "${bright}Searching for packages that provide '${bright}%s${green}'...\n${reset}" "${1}"
|
||||
|
||||
if ! "${PM_COMMAND[@]}" fq "/usr/bin/$1"; then
|
||||
printf "${bright}${green}[ ${1} ]${reset} ${purple}NOT${reset} found in the system and no package provides it.\n"
|
||||
return 127
|
||||
else
|
||||
printf "${green}[ ${1} ] ${reset} might be provided by the above packages.\n"
|
||||
for entry in $entries; do
|
||||
# Assuming the entry already has ANSI color codes, we don't add more colors
|
||||
printf " %s\n" "${entry}"
|
||||
done
|
||||
|
||||
fi
|
||||
return 127
|
||||
}
|
||||
|
||||
# Function to display a slow load warning
|
||||
# the intention is for hyprdots users who might have multiple zsh initialization
|
||||
function _slow_load_warning {
|
||||
local lock_file="/tmp/.hyde_slow_load_warning.lock"
|
||||
local load_time=$SECONDS
|
||||
|
||||
# Check if the lock file exists
|
||||
if [[ ! -f $lock_file ]]; then
|
||||
# Create the lock file
|
||||
touch $lock_file
|
||||
|
||||
# Display the warning if load time exceeds the limit
|
||||
time_limit=3
|
||||
if ((load_time > time_limit)); then
|
||||
cat <<EOF
|
||||
⚠️ Warning: Shell startup took more than ${time_limit} seconds. Consider optimizing your configuration.
|
||||
1. This might be due to slow plugins, slow initialization scripts.
|
||||
2. Duplicate plugins initialization.
|
||||
- navigate to ~/.zshrc and remove any 'source ZSH/oh-my-zsh.sh' or
|
||||
'source ~/.oh-my-zsh/oh-my-zsh.sh' lines.
|
||||
- HyDE already sources the oh-my-zsh.sh file for you.
|
||||
- It is important to remove all HyDE related
|
||||
configurations from your .zshrc file as HyDE will handle it for you.
|
||||
- Check the '.zshrc' file from the repo for a clean configuration.
|
||||
https://github.com/HyDE-Project/HyDE/blob/master/Configs/.zshrc
|
||||
3. Check the '~/.user.zsh' file for any slow initialization scripts.
|
||||
|
||||
For more information, on the possible causes of slow shell startup, see:
|
||||
🌐 https://github.com/HyDE-Project/HyDE/wiki
|
||||
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to handle initialization errors
|
||||
function handle_init_error {
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error during initialization. Please check your configuration."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function no_such_file_or_directory_handler {
|
||||
local red='\e[1;31m' reset='\e[0m'
|
||||
printf "${red}zsh: no such file or directory: %s${reset}\n" "$1"
|
||||
return 127
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# # Warn if the shell is slow to load
|
||||
# add-zsh-hook -Uz precmd _slow_load_warning #! try to not use for now as we already move zshrc
|
6
.config/zsh/functions/eza.zsh
Normal file
6
.config/zsh/functions/eza.zsh
Normal file
@@ -0,0 +1,6 @@
|
||||
if command -v "eza" &>/dev/null; then
|
||||
alias l='eza -lh --icons=auto' \
|
||||
ll='eza -lha --icons=auto --sort=name --group-directories-first' \
|
||||
ld='eza -lhD --icons=auto' \
|
||||
lt='eza --icons=auto --tree'
|
||||
fi
|
77
.config/zsh/functions/fzf.zsh
Normal file
77
.config/zsh/functions/fzf.zsh
Normal file
@@ -0,0 +1,77 @@
|
||||
# best fzf aliases ever
|
||||
_fuzzy_change_directory() {
|
||||
local initial_query="$1"
|
||||
local selected_dir
|
||||
local fzf_options=('--preview=ls -p {}' '--preview-window=right:60%')
|
||||
fzf_options+=(--height "80%" --layout=reverse --preview-window right:60% --cycle)
|
||||
local max_depth=7
|
||||
|
||||
if [[ -n "$initial_query" ]]; then
|
||||
fzf_options+=("--query=$initial_query")
|
||||
fi
|
||||
|
||||
#type -d
|
||||
selected_dir=$(find . -maxdepth $max_depth \( -name .git -o -name node_modules -o -name .venv -o -name target -o -name .cache \) -prune -o -type d -print 2>/dev/null | fzf "${fzf_options[@]}")
|
||||
|
||||
if [[ -n "$selected_dir" && -d "$selected_dir" ]]; then
|
||||
cd "$selected_dir" || return 1
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
_fuzzy_edit_search_file_content() {
|
||||
# [f]uzzy [e]dit [s]earch [f]ile [c]ontent
|
||||
local selected_file
|
||||
local fzf_options=()
|
||||
local preview_cmd
|
||||
if command -v "bat" &>/dev/null; then
|
||||
preview_cmd=('bat --color always --style=plain --paging=never {}')
|
||||
else
|
||||
preview_cmd=('cat {}')
|
||||
fi
|
||||
fzf_options+=(--height "80%" --layout=reverse --cycle --preview-window right:60% --preview ${preview_cmd[@]})
|
||||
selected_file=$(grep -irl "${1:-}" ./ | fzf "${fzf_options[@]}")
|
||||
|
||||
if [[ -n "$selected_file" ]]; then
|
||||
if command -v "$EDITOR" &>/dev/null; then
|
||||
"$EDITOR" "$selected_file"
|
||||
else
|
||||
echo "EDITOR is not specified. using vim. (you can export EDITOR in ~/.zshrc)"
|
||||
vim "$selected_file"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "No file selected or search returned no results."
|
||||
fi
|
||||
}
|
||||
|
||||
_fuzzy_edit_search_file() {
|
||||
local initial_query="$1"
|
||||
local selected_file
|
||||
local fzf_options=()
|
||||
fzf_options+=(--height "80%" --layout=reverse --preview-window right:60% --cycle)
|
||||
local max_depth=5
|
||||
|
||||
if [[ -n "$initial_query" ]]; then
|
||||
fzf_options+=("--query=$initial_query")
|
||||
fi
|
||||
|
||||
# -type f: only find files
|
||||
selected_file=$(find . -maxdepth $max_depth -type f 2>/dev/null | fzf "${fzf_options[@]}")
|
||||
|
||||
if [[ -n "$selected_file" && -f "$selected_file" ]]; then
|
||||
if command -v "$EDITOR" &>/dev/null; then
|
||||
"$EDITOR" "$selected_file"
|
||||
else
|
||||
echo "EDITOR is not specified. using vim. (you can export EDITOR in ~/.zshrc)"
|
||||
vim "$selected_file"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
alias ffec='_fuzzy_edit_search_file_content' \
|
||||
ffcd='_fuzzy_change_directory' \
|
||||
ffe='_fuzzy_edit_search_file'
|
34
.config/zsh/user.zsh
Normal file
34
.config/zsh/user.zsh
Normal file
@@ -0,0 +1,34 @@
|
||||
# Startup
|
||||
# Commands to execute on startup (before the prompt is shown)
|
||||
# Check if the interactive shell option is set
|
||||
if [[ $- == *i* ]]; then
|
||||
# This is a good place to load graphic/ascii art, display system information, etc.
|
||||
if command -v pokego >/dev/null; then
|
||||
pokego --no-title -r 1,3,6
|
||||
elif command -v pokemon-colorscripts >/dev/null; then
|
||||
pokemon-colorscripts --no-title -r 1,3,6
|
||||
elif command -v fastfetch >/dev/null; then
|
||||
if do_render "image"; then
|
||||
fastfetch --logo-type kitty
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Plugins
|
||||
# manually add your oh-my-zsh plugins here
|
||||
plugins=(
|
||||
"sudo"
|
||||
)
|
||||
|
||||
# Overrides
|
||||
# unset HYDE_ZSH_NO_PLUGINS # Set to 1 to disable loading of oh-my-zsh plugins, useful if you want to use your zsh plugins system
|
||||
# unset HYDE_ZSH_PROMPT # Uncomment to unset/disable loading of prompts from HyDE and let you load your own prompts
|
||||
# HYDE_ZSH_COMPINIT_CHECK=1 # Set 24 (hours) per compinit security check // lessens startup time
|
||||
# HYDE_ZSH_OMZ_DEFER=1 # Set to 1 to defer loading of oh-my-zsh plugins ONLY if prompt is already loaded
|
||||
|
||||
# Aliases
|
||||
alias l='eza -1h --icons=auto --sort=name --group-directories-first' # long list
|
||||
alias ls='eza -l --icons=auto --sort=name --group-directories-first' # short list
|
||||
alias ll='eza -lha --icons=auto --sort=name --group-directories-first' # long list all
|
||||
alias дд='eza -lha --icons=auto --sort=name --group-directories-first' # sometimes i forget to change keyboard layout
|
||||
|
149
.zshrc
149
.zshrc
@@ -1,149 +0,0 @@
|
||||
# Enable Powerlevel10k instant prompt
|
||||
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
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
ZSH=/usr/share/oh-my-zsh/
|
||||
|
||||
# Path to powerlevel10k theme
|
||||
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
|
||||
|
||||
# List of plugins used
|
||||
plugins=( git sudo zsh-256color zsh-autosuggestions zsh-syntax-highlighting )
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# In case a command is not found, try to find the package that has it
|
||||
function command_not_found_handler {
|
||||
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
|
||||
printf 'zsh: command not found: %s\n' "$1"
|
||||
local entries=( ${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"} )
|
||||
if (( ${#entries[@]} )) ; then
|
||||
printf "${bright}$1${reset} may be found in the following packages:\n"
|
||||
local pkg
|
||||
for entry in "${entries[@]}" ; do
|
||||
local fields=( ${(0)entry} )
|
||||
if [[ "$pkg" != "${fields[2]}" ]] ; then
|
||||
printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
|
||||
fi
|
||||
printf ' /%s\n' "${fields[4]}"
|
||||
pkg="${fields[2]}"
|
||||
done
|
||||
fi
|
||||
return 127
|
||||
}
|
||||
|
||||
# Detect the AUR wrapper
|
||||
if pacman -Qi yay &>/dev/null ; then
|
||||
aurhelper="yay"
|
||||
elif pacman -Qi paru &>/dev/null ; then
|
||||
aurhelper="paru"
|
||||
fi
|
||||
|
||||
# Cache AUR helper detection
|
||||
if [[ -z "$aurhelper" ]]; then
|
||||
if command -v yay >/dev/null 2>&1; then
|
||||
export aurhelper="yay"
|
||||
elif command -v paru >/dev/null 2>&1; then
|
||||
export aurhelper="paru"
|
||||
fi
|
||||
fi
|
||||
|
||||
function in {
|
||||
local -a inPkg=("$@")
|
||||
local -a arch=()
|
||||
local -a aur=()
|
||||
|
||||
for pkg in "${inPkg[@]}"; do
|
||||
if pacman -Si "${pkg}" &>/dev/null ; then
|
||||
arch+=("${pkg}")
|
||||
else
|
||||
aur+=("${pkg}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#arch[@]} -gt 0 ]]; then
|
||||
sudo pacman -S "${arch[@]}"
|
||||
fi
|
||||
|
||||
if [[ ${#aur[@]} -gt 0 ]]; then
|
||||
${aurhelper} -S "${aur[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Helpful aliases
|
||||
alias c='clear' # clear terminal
|
||||
alias l='eza -1h --icons=auto --sort=name --group-directories-first' # long list
|
||||
alias ls='eza -l --icons=auto --sort=name --group-directories-first' # short list
|
||||
alias ll='eza -lha --icons=auto --sort=name --group-directories-first' # long list all
|
||||
alias дд='eza -lha --icons=auto --sort=name --group-directories-first' # sometimes i forget to change keyboard layout
|
||||
alias lt='eza --icons=auto --tree' # list folder as tree
|
||||
alias un='$aurhelper -Rns' # uninstall package
|
||||
alias up='$aurhelper -Syu' # update system/package/aur
|
||||
alias pl='$aurhelper -Qs' # list installed package
|
||||
alias pa='$aurhelper -Ss' # list available package
|
||||
alias pc='$aurhelper -Sc' # remove unused cache
|
||||
alias po='$aurhelper -Qtdq | $aurhelper -Rns -' # remove unused packages, also try > $aurhelper -Qqd | $aurhelper -Rsu --print -
|
||||
alias pcc="sudo pacman -Sc" # remove pacman cache
|
||||
alias icat='kitten icat' # display images in terminal
|
||||
alias ssh='kitten ssh' # functional ssh with kitty
|
||||
alias snv='sudo -E nvim' # sudo nvim
|
||||
alias nv='nvim'
|
||||
alias ff='fastfetch'
|
||||
alias pi='ssh omoelle'
|
||||
alias pi-mount='sshfs omoelle:/home/elleoma ~/mnt && cd ~/mnt'
|
||||
alias cat='bat --paging=never'
|
||||
alias wifi="nmcli d wifi show-password | grep 'Password' | awk -F': ' '{ print \$2 }'"
|
||||
alias pivpn="wg-quick up laptop"
|
||||
alias config='git --git-dir=/home/elleoma/.config --work-tree=/home/elleoma'
|
||||
|
||||
# git aliases
|
||||
alias gs='git status '
|
||||
alias ga='git add '
|
||||
alias gb='git branch '
|
||||
alias gc='git commit'
|
||||
alias gd='git diff'
|
||||
alias gco='git checkout '
|
||||
alias gk='gitk --all&'
|
||||
alias gx='gitx --all'
|
||||
alias got='git '
|
||||
alias get='git '
|
||||
alias gut='git '
|
||||
|
||||
|
||||
# Handy change dir shortcuts
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias .3='cd ../../..'
|
||||
alias .4='cd ../../../..'
|
||||
alias .5='cd ../../../../..'
|
||||
|
||||
# Alias for cross-compile to windows
|
||||
#alias x86_64-w64-mingw32-g++='mingw'
|
||||
|
||||
# Always mkdir a path (this doesn't inhibit functionality to make a single dir)
|
||||
alias mkdir='mkdir -p'
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
|
||||
# Syntax highlighting for man pages
|
||||
export MANPAGER='nvim +Man!'
|
||||
|
||||
# Setting Ruby path
|
||||
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
|
||||
export PATH="$PATH:$GEM_HOME/bin"
|
||||
|
||||
# Created by `pipx` on 2025-02-01 15:08:39
|
||||
export PATH="$PATH:/home/elleoma/.local/bin"
|
||||
|
||||
# Setting up Rust
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
|
||||
export SDKMAN_DIR="$HOME/.sdkman"
|
||||
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
export PATH=~/.npm-global/bin:$PATH
|
||||
|
||||
# go binaries path
|
||||
export PATH=~/go/bin:$PATH
|
Reference in New Issue
Block a user