From 4dd3c3eed603bca2bf459beef6fdfc66ec606eb7 Mon Sep 17 00:00:00 2001 From: FaultyBranches Date: Sun, 29 Mar 2026 16:21:11 -0500 Subject: [PATCH] feat: Adding a new function to print out the path variable in a newline delimited list, new aliases for quick actions and cleanup of zshrc for future changes --- zsh/zsh_aliases | 2 + zsh/zsh_functions | 13 +++++++ zsh/zshrc | 95 ++++++++++++++++++++++++++++++----------------- 3 files changed, 75 insertions(+), 35 deletions(-) diff --git a/zsh/zsh_aliases b/zsh/zsh_aliases index 6e828a8..c8709ea 100644 --- a/zsh/zsh_aliases +++ b/zsh/zsh_aliases @@ -7,3 +7,5 @@ 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" +alias repos="cd ~/repos/" +alias dot="cd ~/repos/dotfiles" diff --git a/zsh/zsh_functions b/zsh/zsh_functions index 6c08619..2548524 100644 --- a/zsh/zsh_functions +++ b/zsh/zsh_functions @@ -16,3 +16,16 @@ function rmv() { rsync -avzhP --remove-source-files --ignore-existing "${@:1:$#-1}" "${@:$#}" && \ find ./* -depth -type d -empty -exec rmdir "{}" \; } + +function new_note() { + nvim +} + +function path() { + set -f + array=(${${PATH}//:/\\n}) + for element in "${array[@]}" + do + echo $element + done +} diff --git a/zsh/zshrc b/zsh/zshrc index 3cea589..67f1c92 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,21 +1,38 @@ # 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 + +# Path additions +path=( + $GOPATH/bin + $HOME/.cargo/bin + $HOME/.local/bin + $NVM_CONFIG_PREFIX/bin + $path +) + +typeset -U path + +if type brew; then + source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh +else + source /usr/share/zsh/site-functions/zsh-autosuggestions.zsh +fi # Install oh-my-zsh if it doesn't exist -if [ ! -d $HOME/.oh-my-zsh/ ] -then - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -fi +# if [ ! -d $HOME/.oh-my-zsh/ ] +# then + # sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" +# fi ### ZSH Configuration ## Path variables # Path to your oh-my-zsh installation. -export ZSH="$HOME/.oh-my-zsh" +# export ZSH="$HOME/.oh-my-zsh" export MANPAGER="less -R --use-color -Dd+r -Du+b" # Colored MAN pages -ZSH_THEME="fb-custom" +# ZSH_THEME="fb-custom" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. @@ -24,29 +41,40 @@ DISABLE_AUTO_UPDATE="true" ### Plugins # Install the zsh-autosuggestions plugin if it doesn't exist -if [ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ] -then - git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +# if [ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ] +# then + # git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +# fi + +# plugins=( + # zsh-autosuggestions + # virtualenvwrapper # Used for autoloading project .venvs +# ) + +# ZSH autosuggestions +if type brew &>/dev/null; then fi -plugins=( - fzf - zsh-autosuggestions - virtualenvwrapper # Used for autoloading project .venvs -) +autoload -Uz compinit +compinit -u -# Load Oh My ZSH -source $ZSH/oh-my-zsh.sh +# FZF load +source <(fzf --zsh) + +# Vim mode setup +set -o vi # ZSH options -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_space # Remove history lines that start with spaces +setopt share_history # Share history between zsh instances without needing explicit sharing +setopt auto_param_slash # Auto append a slash instead of a space if the completion is a dir # Experimental -setopt append_history inc_append_history share_history -setopt auto_param_slash +setopt append_history inc_append_history setopt no_case_glob no_case_match +setopt extended_glob null_glob # Completion options # Give descriptions of what the types of completions given @@ -58,22 +86,18 @@ zstyle ':completion:*:warnings' format '%BNo matches for: %d%b' export EDITOR=nvim export NVM_CONFIG_PREFIX=$HOME/.local/ -# Paths to prepend to system path -path=( - $GOPATH/bin - $HOME/.cargo/bin - $HOME/.local/bin - $NVM_CONFIG_PREFIX/bin - $path -) - # Autoload keychain for ssh-agent handling if it is installed -if command -v keychain &> /dev/null -then - eval $(keychain --eval --quiet --nogui --noask) -fi +# if command -v keychain &> /dev/null +# then + # eval $(keychain --eval --quiet --nogui --noask) +# fi -### Environment specific include files +# TODO: Replace above with GPG agent +# GPG Agent handling of ssh key authorization and unlocks + + +# Inclusion of files to extend the configuration +# From a theme to local specific changes, and grouping functions/aliases/exports include_files=( "$HOME/.config/zsh/fb_theme.zsh" "$HOME/.config/zsh/zsh_local.zsh" @@ -91,5 +115,6 @@ for file in $include_files; do source $file done + # Call to zprof for startup timings -# zprof +zprof