Modified zshrc

This commit is contained in:
TheFlyingFool 2025-05-11 21:32:09 -05:00
parent b65f69da7e
commit c54f7cccf1

103
.zshrc
View File

@ -17,13 +17,26 @@
##History
HISTFILE=~/.zsh_history
HISTSIZE=25000
SAVEHIST=12500
HISTSIZE=100000
SAVEHIST=50000
setopt INC_APPEND_HISTORY
setopt incappendhistory
setopt sharehistory
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_ALL_DUPS
setopt appendhistory
setopt autocd
setopt beep
setopt nomatch
setopt correct
setopt noclobber
setopt prompt_subst
setopt notify
unsetopt extendedglob
bindkey -v
# make history searchable with ctrl-r
bindkey "^r" history-incremental-search-backward
@ -37,11 +50,9 @@ export VISUAL=$EDITOR
# export GITEA_TOKEN=a2a8542ad8fcf4de4156e9b5a83c09f826e53dc0
# export GITEA_TOKEN=55fa045ffdc1ffabbabcdc429e353e4883b04b17
##Alias
export SSH_AUTH_SOCK=/home/nick/.bitwarden-ssh-agent.sock
source ~/.alias
setopt appendhistory autocd beep nomatch correct noclobber
unsetopt extendedglob notify
bindkey -v
zstyle :compinstall filename '/home/nick/.zshrc'
@ -74,15 +85,28 @@ if [ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ]; then
fi
#eval 'keychain --eval id_ed25519'
if [[ -f /usr/bin/keychain ]] then
keychain --agents gpg,ssh id_ed25519 31936033 github_rsa
[ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
[ -f $HOME/.keychian/$HOSTNAME-sh ]
source $HOME/.keychain/$HOSTNAME-sh ]
[ -f $HOME/.keychain/$HOSTNAME-sh-gpg ]
source $HOME/.keychain/$HOSTNAME-sh-gpg
fi
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' format ''\''Completing %d'\'''
zstyle ':completion:*' max-errors 3 numeric
zstyle ':completion:*' prompt 'Errors '\''%e'\'''
zstyle :compinstall filename '/home/nick/.zshrc'
autoload -Uz compinit
compinit
# #eval 'keychain --eval id_ed25519'
# if [[ -f /usr/bin/keychain ]]; then
# keychain --agents gpg,ssh id_ed25519 31936033 github_rsa
# [ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
# [ -f $HOME/.keychian/$HOSTNAME-sh ]
# source $HOME/.keychain/$HOSTNAME-sh ]
# [ -f $HOME/.keychain/$HOSTNAME-sh-gpg ]
# source $HOME/.keychain/$HOSTNAME-sh-gpg
# fi
##Prompt
@ -100,22 +124,10 @@ else
%#"
fi
###Alias
#alias aurup="cd ~/AUR && echo $PWD && cower -ubddf --color" #AUR Update
#alias aurSs="cd ~/AUR && cower -s --color" #Search AUR
#alias aurS="cd ~/AUR && cower -dd --color" #Download PKGBUILD and depends
#ZFS Related #zfs, and zpool both set to NOPASSWD via sudoers file
#alias zfs="sudo zfs"
#alias zpool="sudo zpool"
#alias scrub="sudo zpool scrub" #preforms scrub
# Adapted from code found at <https://gist.github.com/1712320>.
setopt prompt_subst
# Modify the colors and symbols in these variables as desired.
#GIT_PROMPT_SYMBOL="%{$fg[blue]%}±"
GIT_PROMPT_SYMBOL="%{$fg[blue]%}±"
GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$reset_color%}"
GIT_PROMPT_SUFFIX="%{$fg[green]%}]%{$reset_color%}"
GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}"
@ -187,12 +199,37 @@ RPS1='$(git_prompt_string)'
# Created by `pipx` on 2025-03-03 18:34:12
export PATH="$PATH:/home/nick/.local/bin"
# show_venv() {
# if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
# echo "($(basename $VIRTUAL_ENV))"
# fi
# }
#PS1='$(show_venv)'$PS1
# requires direnv to be installed
eval "$(direnv hook zsh)"
show_venv() {
if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
echo "($(basename $VIRTUAL_ENV))"
fi
}
RPS1='$(show_venv)'$RPS1
## UNTESTED NEEDS REVIEW
# SHOULD Allow > / >> to auto create directories
# # This function will be called before executing any command
# preexec() {
# # Match something like > ~/path/to/file or >> ~/path/to/file
# if [[ "$1" =~ '>>?\s*(~?/.+)' ]]; then
# local outfile=${match[1]}
# # Expand ~ to full path
# outfile=${outfile/#\~/$HOME}
# local outdir=$(dirname "$outfile")
# if [[ ! -d "$outdir" ]]; then
# echo "Output redirection to: $outfile"
# echo -n "Directory '$outdir' does not exist. Create it? [Y/n]: "
# read -r reply
# if [[ -z "$reply" || "$reply" =~ ^[Yy] ]]; then
# mkdir -p "$outdir"
# echo "✅ Created $outdir"
# else
# echo "❌ Skipped creating directory. Command might fail."
# fi
# fi
# fi
# }