feat: Update to the zsh setup, moving functions and aliases to their own

files, changing up the plugins and settings to remove stale setups and
to reduce the loading time by nearly half
This commit is contained in:
2026-03-28 16:53:51 -05:00
parent a31d423095
commit 64868c6672
4 changed files with 39 additions and 70 deletions

View File

@@ -6,7 +6,9 @@
# Relative path/name as keys, destination path as values # Relative path/name as keys, destination path as values
declare -A configs=( declare -A configs=(
["zshrc"]="$HOME/.zshrc" ["zsh/zshrc"]="$HOME/.zshrc"
["zsh/zsh_functions"]="$HOME/.config/zsh/zsh_functions.zsh"
["zsh/zsh_aliases"]="$HOME/.config/zsh/zsh_aliases.zsh"
["fb-custom.zsh-theme"]="$HOME/.oh-my-zsh/custom/themes" ["fb-custom.zsh-theme"]="$HOME/.oh-my-zsh/custom/themes"
["nvim/init.lua"]="$HOME/.config/nvim/init.lua" ["nvim/init.lua"]="$HOME/.config/nvim/init.lua"
["nvim/lua"]="$HOME/.config/nvim/" ["nvim/lua"]="$HOME/.config/nvim/"

9
zsh/zsh_aliases Normal file
View File

@@ -0,0 +1,9 @@
# Aliases Universal
alias rm="rm -I" # Prompt for removal of more than three files or recursively to give some protection of mistakes
alias mv="mv -i" # Prompt before moving files
alias df="df -h" # Always use the human readable formatting
alias du="du -h -d 1" # Always use human readable format and only for the current dir by default
alias k="killall" # Quick killall
alias p="ps aux | grep $1" # Quick
alias n="$EDITOR" # Just open the usual editor
alias todo="nvim ~/.zettelkasten/TODO.md"

18
zsh/zsh_functions Normal file
View File

@@ -0,0 +1,18 @@
### Custom functions
# Timing function for checking zsh load speed
function timezsh() {
shell=$SHELL
for i in $(seq 1 10)
do
ts=$(date +%s%N)
$SHELL -i -c exit
echo $((($(date +%s%N) - $ts)/1000000))ms
done
}
# Custom rsync move function that also removes empty directories that have their contents removed
# NOTE: This will delete *any* empty directories in the CWD
function rmv() {
rsync -avzhP --remove-source-files --ignore-existing "${@:1:$#-1}" "${@:$#}" && \
find ./* -depth -type d -empty -exec rmdir "{}" \;
}

View File

@@ -1,4 +1,5 @@
# call `zprof` to profile all calls in the current shell # call `zprof` to profile all calls in the current shell
# Uncomment here and at the bottom of the file, then fully reopen a terminal
# zmodload zsh/zprof # zmodload zsh/zprof
# Install oh-my-zsh if it doesn't exist # Install oh-my-zsh if it doesn't exist
@@ -11,9 +12,6 @@ fi
## Path variables ## Path variables
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh" export ZSH="$HOME/.oh-my-zsh"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export MANPAGER="less -R --use-color -Dd+r -Du+b" # Colored MAN pages export MANPAGER="less -R --use-color -Dd+r -Du+b" # Colored MAN pages
@@ -22,22 +20,7 @@ ZSH_THEME="fb-custom"
# Uncomment the following line to use hyphen-insensitive completion. # Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable. # Case-sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true" HYPHEN_INSENSITIVE="true"
DISABLE_AUTO_UPDATE="true"
# History
HISTCONTROL=ignoreboth
# Uncomment one of the following lines to change the auto-update behavior
zstyle ':omz:update' mode reminder frequency 14
# Keybindings
bindkey "^a" beginning-of-line
bindkey "^e" end-of-line
# bindkey "^h" backward-word
# bindkey "^k" kill-line
# bindkey "^j" backward-word
# bindkey "^k" forward-word
# bindkey "^J" history-search-forward
# bindkey "^K" history-search-backward
### Plugins ### Plugins
# Install the zsh-autosuggestions plugin if it doesn't exist # Install the zsh-autosuggestions plugin if it doesn't exist
@@ -47,14 +30,8 @@ then
fi fi
plugins=( plugins=(
aws
copypath
dotenv
fzf fzf
git
history
zsh-autosuggestions zsh-autosuggestions
virtualenv
virtualenvwrapper # Used for autoloading project .venvs virtualenvwrapper # Used for autoloading project .venvs
) )
@@ -65,20 +42,11 @@ source $ZSH/oh-my-zsh.sh
setopt NO_clobber # Do not clobber files by default setopt NO_clobber # Do not clobber files by default
setopt hist_ignore_all_dups # Replace old history with the newest call to an identical call setopt hist_ignore_all_dups # Replace old history with the newest call to an identical call
setopt hist_ignore_space # Remove history lines that start with spaces setopt hist_ignore_space # Remove history lines that start with spaces
# setopt correctall # Correct commands
# Experimental # Experimental
setopt append_history inc_append_history share_history setopt append_history inc_append_history share_history
# setopt auto_menu menu_complete
# setopt autocd
setopt auto_param_slash setopt auto_param_slash
setopt no_case_glob no_case_match setopt no_case_glob no_case_match
# setopt globdots
# Enable compinit advanced completion
zmodload zsh/complist
autoload -Uz compinit && compinit
autoload -U colors && colors
# Completion options # Completion options
# Give descriptions of what the types of completions given # Give descriptions of what the types of completions given
@@ -105,32 +73,13 @@ then
eval $(keychain --eval --quiet --nogui --noask) eval $(keychain --eval --quiet --nogui --noask)
fi fi
### Custom functions
# Timing function for checking zsh load speed
timezsh() {
shell=$SHELL
for i in $(seq 1 10)
do
ts=$(date +%s%N)
$SHELL -i -c exit
echo $((($(date +%s%N) - $ts)/1000000))ms
done
}
# Aliases Universal
alias rm="rm -Iv" # Prompt for removal of more than three files or recursively to give some protection of mistakes
alias df="df -h" # Always use the human readable formatting
alias du="du -h -d 1" # Always use human readable format and only for the current dir by default
alias k="killall" # Quick killall
alias p="ps aux | grep $1" # Quick
alias v="$EDITOR" # Just open the usual editor
alias todo="nvim ~/.zettelkasten/TODO.md"
### Environment specific include files ### Environment specific include files
include_files=( include_files=(
"$HOME/.zsh_aliases" "$HOME/.config/zsh/fb_theme.zsh"
"$HOME/.zsh_exports" "$HOME/.config/zsh/zsh_local.zsh"
"$HOME/.zsh_local" "$HOME/.config/zsh/zsh_aliases.zsh"
"$HOME/.config/zsh/zsh_exports.zsh"
"$HOME/.config/zsh/zsh_functions.zsh"
) )
for file in $include_files; do for file in $include_files; do
@@ -142,14 +91,5 @@ for file in $include_files; do
source $file source $file
done done
# Custom rsync move function that also removes empty directories that have their contents removed # Call to zprof for startup timings
# NOTE: This will delete *any* empty directories in the CWD # zprof
rmv() {
rsync -avzhP --remove-source-files --ignore-existing "${@:1:$#-1}" "${@:$#}" && \
find ./* -depth -type d -empty -exec rmdir "{}" \;
}
# NVM required config
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion