master
Felix Pankratz 5 months ago
parent cc6a54b8f2
commit 0d61dc21b9

100
.zshrc

@ -2,25 +2,27 @@
# .zshrc - started by panki on 20200226
#
fpath+=($HOME/.zsh/pure)
autoload -Uz compinit promptinit
autoload -z edit-command-line
zle -N edit-command-line
compinit
promptinit
# This will set the default prompt to the fade theme
prompt fade green
# fix background color being black...
PS1=${PS1//\%K{black}/%k}
# Return Code on right prompt
RPS1='[%F{yellow}%?%f]'
# history stuff
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
HISTSIZE=9000
SAVEHIST=9000
setopt appendhistory
bindkey -e
path+=('/home/panki/.local/bin')
# thanks to slashbeast for these ones
@ -40,41 +42,61 @@ cd() {
fi
}
setup_git_prompt() {
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
unset git_prompt
return 0
fi
local git_status_dirty git_branch
if [ "$(git status --untracked-files='no' --porcelain)" ]; then
git_status_dirty='%F{green}*'
else
unset git_status_dirty
fi
git_branch="$(git symbolic-ref HEAD 2>/dev/null)"
git_branch="${git_branch#refs/heads/}"
if [ "${#git_branch}" -ge 24 ]; then
git_branch="${git_branch:0:21}..."
fi
git_branch="${git_branch:-no branch}"
git_prompt=" %F{blue}[%F{253}${git_branch}${git_status_dirty}%F{blue}]"
alias sudo='sudo --preserve-env=HOME'
alias grep='grep --colour=auto'
alias ls='ls --color=auto'
alias ll='ls -alFh'
alias vi='nvim'
alias vim='vi'
alias devel='cd /mnt/c/devel'
alias desk='cd /mnt/c/Users/PankratzF/Desktop'
alias e='explorer.exe .'
alias nmap='/mnt/c/Program\ Files\ \(x86\)/Nmap/nmap.exe'
alias sudo='sudo '
alias ds='dig +short'
alias kw='date +%V'
lt () { ls -lt ${1} | head }
# define slash and underscore as word separators
WORDCHARS=${WORDCHARS/\/}
WORDCHARS=${WORDCHARS/_}
# vi stuff
if [[ "$(command -v nvim)" ]]; then
export EDITOR='nvim'
export MANPAGER='nvim +Man!'
export MANWIDTH=999
fi
# jump to man flag
function fman () { man -P "less -p \"^ +$2\"" $1 }
# fzf stuff
export FZF_TMUX=1
export FZF_DEFAULT_OPTS='--height 40%'
export FZF_COMPLETION_TRIGGER='~~'
source /usr/share/doc/fzf/examples/key-bindings.zsh
alias fp='fzf --preview "bat --style=numbers --color=always --line-range :500 {}"'
# cheat - display text reminders
function cheat() {
bat -l md -p ~/cheat/"$1"
}
compdef '_files -W "/home/panki/cheat"' cheat
precmd() {
setup_git_prompt
}
# tokens etc
source ~/.exports
PS1='%F{green}%B%K{green}█▓▒░%F{white}%K{green}%B%n@%m%b%F{green}%K{black}█▓▒░%F{white}%K{black}%B %D{%a %b %d} %D{%I:%M:%S%P}
%}%F{green}%K{black}%B%~/%b%k${git_prompt}%f '
# aliases
alias grep='grep --colour=auto'
alias ll='ls -alFh'
lt () { ls -lt ${1} | head }
EDITOR=vim
# wezterm
source ~/.zsh/wezterm.sh
# This will set the default prompt to the fade theme
if [[ $UID -eq 0 ]]; then
HISTFILE="${HISTFILE%_history}_root_history"
prompt fade red
else
HISTFILE=~/.histfile
prompt pure
fi
ICONS=(😈 💀 🤡 👻 👽 👾 🤖 😺 💋 💥 🦥 🐣 🐧 🐸 🐢 🐍 🐳 🌴 🍉 🍎 🍒 🥝 🥥 🥨 🍕 ☕ 🚨 🚀 🛸 🪐 🌠 🌙 🌞 🌈 ⚡ 🔥 💧 ✨ 🎉 💎 💾 📎 💣 📡 )
export PURE_PROMPT_SYMBOL="$(shuf -n1 -e "${ICONS[@]}")"
__wezterm_set_user_var "ICON" $PURE_PROMPT_SYMBOL

Loading…
Cancel
Save