151 lines
4.9 KiB
Plaintext
151 lines
4.9 KiB
Plaintext
# If you're using fastfetch with Powerlevel10k's instant prompt feature, it's a known source of incompatibility. fastfetch command in your .zshrc file is placed before the initialization of p10k-instant-prompt
|
|
fastfetch
|
|
|
|
############################# CHECK IF INSTALLED, IF NOT THEN INSTALL ###########################
|
|
if [ ! -f "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k/powerlevel10k.zsh-theme" ]; then
|
|
echo "Powerlevel10k not found. Installing..."
|
|
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
|
|
echo "Powerlevel10k installed."
|
|
fi
|
|
|
|
# Check if Starship is installed, if not, install it
|
|
if ! command -v starship &> /dev/null; then
|
|
echo "Starship not found, installing..."
|
|
sudo apt update
|
|
sudo apt install starship -y
|
|
fi
|
|
|
|
# Check if Oh My Zsh is installed
|
|
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
|
# Oh My Zsh is not installed, proceed with installation
|
|
echo "Oh My Zsh not found. Installing..."
|
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
|
else
|
|
# Oh My Zsh is installed, source it
|
|
source $HOME/.oh-my-zsh/oh-my-zsh.sh
|
|
fi
|
|
|
|
########################## EXPORT PATHS #########################################################
|
|
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
|
export ZSH="$HOME/.oh-my-zsh"
|
|
# You may need to manually set your language environment
|
|
export LANG=en_US.UTF-8
|
|
# Added by LM Studio CLI (lms)
|
|
export PATH="$PATH:/home/miker/.lmstudio/bin"
|
|
|
|
######################### HISTORY CONTROLS #######################################################
|
|
HISTCONTROL=ignoreboth
|
|
HISTSIZE=100000
|
|
HISTFILESIZE=100000
|
|
HISTFILE=~/.zsh_history
|
|
setopt INC_APPEND_HISTORY
|
|
setopt hist_ignore_all_dups # remove older duplicate entries from history
|
|
setopt hist_reduce_blanks # remove superfluous blanks from history items
|
|
setopt inc_append_history # save history entries as soon as they are entered
|
|
setopt share_history # share history between different instances of the shell
|
|
setopt auto_cd # cd by typing directory name if it's not a command
|
|
setopt correct_all # autocorrect commands
|
|
setopt auto_list # automatically list choices on ambiguous completion
|
|
setopt auto_menu # automatically use menu completion
|
|
setopt always_to_end # move cursor to end if word had one match
|
|
|
|
########################### POWERLEVEL & ZSH & OH-MY-ZSH SETTINGS ################################
|
|
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
|
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
|
|
|
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
|
|
|
# Set the zsh theme to powerlevel10k
|
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
|
|
|
# update automatically without asking
|
|
zstyle ':omz:update' mode auto
|
|
|
|
# Uncomment the following line to change how often to auto-update (in days).
|
|
zstyle ':omz:update' frequency 13
|
|
|
|
# Uncomment the following line to enable command auto-correction.
|
|
ENABLE_CORRECTION="true"
|
|
|
|
# Add wisely, as too many plugins slow down shell startup.
|
|
plugins=(
|
|
git
|
|
zsh-autosuggestions
|
|
zsh-bat
|
|
ansible
|
|
colored-man-pages
|
|
terraform
|
|
systemadmin
|
|
aliases
|
|
alias-finder
|
|
zoxide
|
|
ubuntu
|
|
ssh
|
|
kate
|
|
fzf
|
|
zsh-syntax-highlighting
|
|
)
|
|
|
|
# Cache completions aggressively
|
|
autoload -Uz compinit
|
|
if [ "$(date +'%j')" != "$(stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)" ]; then
|
|
compinit
|
|
else
|
|
compinit -C
|
|
fi
|
|
|
|
# Load oh my zsh
|
|
source $ZSH/oh-my-zsh.sh
|
|
source ~/powerlevel10k/powerlevel10k.zsh-theme
|
|
|
|
################################ SETTING EDITOR ###################################################
|
|
if [[ -n $SSH_CONNECTION ]]; then
|
|
export EDITOR='nano'
|
|
else
|
|
export EDITOR='nano'
|
|
fi
|
|
|
|
################################## GITHUB EXPORT ###################################################
|
|
export GITHUB_USERNAME="mmcferidge1969"
|
|
export GITHUB_EMAIL="mmcfetridg@aol.com"
|
|
|
|
################################## CD INTO DIR AND LIST ############################################
|
|
cd() {
|
|
builtin cd "$@" && ls -lA
|
|
}
|
|
|
|
################################# GIT GLOBAL SETTINGS ################################################
|
|
git config --global user.name "mmcfetridge1969"
|
|
git config --global user.email "mmcfetridg@aol.com"
|
|
|
|
# Git Branch Function
|
|
parse_git_branch() {
|
|
local branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
if [[ -n "$branch" ]]; then
|
|
local dirty=$(git status --porcelain 2>/dev/null | grep -q '^[A-Z]' && echo "*" || true)
|
|
echo "[$branch$dirty]"
|
|
else
|
|
echo ""
|
|
fi
|
|
}
|
|
|
|
########################## SOURCE FILES ##########################################################
|
|
source ~/.zsh_aliases
|
|
source ~/.zsh_functions
|
|
|
|
################################# INITIALIZE APPS ###################################################
|
|
eval "$(starship init zsh)"
|
|
# Set up fzf key bindings and fuzzy completion
|
|
source <(fzf --zsh)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|