mirror of
https://github.com/KiTTYsh/dotfiles.git
synced 2025-12-10 05:09:16 -05:00
90 lines
2.7 KiB
Bash
90 lines
2.7 KiB
Bash
# start the x server if we're on tty0 and nothing is running
|
|
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
|
|
|
|
# Bring "xterm" up to "xterm-256color", fairly well expected this should work
|
|
[[ "$TERM" == "xterm" ]] && export TERM="xterm-256color"
|
|
|
|
# Make sure that p10k.zsh is in place, otherwise link it from dotfiles repo
|
|
if [[ ! -a "$HOME/.p10k.zsh" ]]; then
|
|
DOTFILES_ZSH_DIR="$(dirname "$(readlink -f "$HOME/.zshrc")")"
|
|
if [[ -a "${DOTFILES_ZSH_DIR}/p10k.zsh" ]]; then
|
|
ln -s "${DOTFILES_ZSH_DIR}/p10k.zsh" "$HOME/.p10k.zsh"
|
|
fi
|
|
fi
|
|
|
|
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
|
# Initialization code that may require console input (password prompts, [y/n]
|
|
# confirmations, etc.) must go above this block; everything else may go below.
|
|
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
|
|
|
|
# make sure antigen exists
|
|
if [[ ! -a ~/.antigen.zsh ]]; then
|
|
wget https://git.io/antigen -O ~/.antigen.zsh
|
|
fi
|
|
|
|
# Add .local/bin
|
|
if [[ ! "$PATH" =~ "$HOME/.local/bin" ]]; then
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
# powerlevel9k config
|
|
POWERLEVEL9K_INSTALLATION_PATH=$ANTIGEN_BUNDLES/bhilburn/powerlevel9k
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status root_indicator context dir virtualenv vcs)
|
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(background_jobs)
|
|
POWERLEVEL9K_STATUS_OK=false
|
|
POWERLEVEL9K_VIRTUALENV_BACKGROUND=028
|
|
|
|
# Host-specific configuration
|
|
if [[ "$HOST" == 'hyrrokkin' ]]; then
|
|
POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND=051
|
|
POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=051
|
|
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=000
|
|
POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=000
|
|
elif [[ "$HOST" == 'phoebe.node.tty.sh' ]]; then
|
|
POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=201
|
|
POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=201
|
|
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=000
|
|
POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=000
|
|
fi
|
|
|
|
# load in antigen
|
|
source ~/.antigen.zsh
|
|
|
|
# pull in oh-my-zsh
|
|
antigen use oh-my-zsh
|
|
|
|
# plugins from oh-my-zsh
|
|
antigen bundle git
|
|
|
|
# plugins from other repos
|
|
antigen bundle zsh-users/zsh-autosuggestions
|
|
antigen bundle zsh-users/zsh-syntax-highlighting
|
|
|
|
# set the theme
|
|
#antigen theme agnoster
|
|
antigen theme romkatv/powerlevel10k
|
|
|
|
# finish up
|
|
antigen apply
|
|
|
|
# zsh autosuggestions
|
|
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
|
|
|
# Preferred Editor
|
|
export EDITOR="vim"
|
|
|
|
# commands aliases
|
|
alias svim="sudoedit"
|
|
alias unlock="gpg -o /dev/null -s /dev/null"
|
|
|
|
function dotfiles-update() {
|
|
pushd "$(dirname "$(dirname "$(readlink -f "$HOME/.zshrc")")")" >> /dev/null
|
|
git pull
|
|
popd >> /dev/null
|
|
}
|
|
|
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|