ZSH files being rebuilt first
This commit is contained in:
parent
fb783226e0
commit
a823971026
61
.config/zsh/.alias
Normal file
61
.config/zsh/.alias
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
##############################################################
|
||||||
|
# #
|
||||||
|
# ~/.config/zsh/.alias #
|
||||||
|
# #
|
||||||
|
# Maintainer: #
|
||||||
|
# TheFlyingFool - tff@theflyingfool.com #
|
||||||
|
# http://theflyingfool.com #
|
||||||
|
# https://git.theflyingfool.com/theflyingfool/dotfiles.git #
|
||||||
|
#
|
||||||
|
# Credits:
|
||||||
|
# Package Management Section
|
||||||
|
# https://gist.github.com/rroblak/8137276 #
|
||||||
|
##############################################################
|
||||||
|
|
||||||
|
# vim's nicer than vi
|
||||||
|
alias vi="vim"
|
||||||
|
|
||||||
|
# tmux
|
||||||
|
tmux_alias() {
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
tmux attach
|
||||||
|
else
|
||||||
|
tmux "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
alias tmux=tmux_alias
|
||||||
|
|
||||||
|
# Package Management
|
||||||
|
if [ -e "/usr/bin/pacman" ] ; then # Arch Linux
|
||||||
|
pacman="/usr/bin/pacman --color=auto"
|
||||||
|
sudopacman="sudo $pacman --color=auto"
|
||||||
|
alias S="$sudopacman -S"
|
||||||
|
alias Syy="$sudopacman -Syy"
|
||||||
|
alias Syu="$sudopacman -Syu"
|
||||||
|
alias Rns="$sudopacman -Rns"
|
||||||
|
alias Ss="$pacman -Ss"
|
||||||
|
alias Si="$pacman -Si"
|
||||||
|
alias Q="$pacman -Q"
|
||||||
|
elif [ -e "/usr/bin/yay" ] ; then # Arch Linux with helper
|
||||||
|
yay="/usr/bin/yay"
|
||||||
|
sudoyay="sudo $yay"
|
||||||
|
alias S="$yay -S"
|
||||||
|
alias Syy="$yay -Syy"
|
||||||
|
alias Syu="$yay -Syu"
|
||||||
|
alias Rns="$yay -Rns"
|
||||||
|
alias Ss="$yay -Ss"
|
||||||
|
alias Si="$yay -Si"
|
||||||
|
alias Q="$yay -Q"
|
||||||
|
elif [ -e "/usr/bin/apt-get" ] ; then # Apt-based distros (Debian, Ubuntu, etc.)
|
||||||
|
aptget="/usr/bin/apt-get"
|
||||||
|
sudoaptget="sudo $aptget"
|
||||||
|
aptcache="/usr/bin/apt-cache"
|
||||||
|
dpkg="/usr/bin/dpkg"
|
||||||
|
alias S="$sudoaptget install"
|
||||||
|
alias Syu="$sudoaptget update"
|
||||||
|
alias Ss="$aptcache search"
|
||||||
|
alias Si="$aptcache show"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dotfiles
|
||||||
|
alias dot="git --git-dir=$HOME/Repos/dotfiles/ --work-tree=$HOME"
|
104
.config/zsh/.zshrc
Normal file
104
.config/zsh/.zshrc
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
##############################################################
|
||||||
|
# #
|
||||||
|
# ~/.zshrc #
|
||||||
|
# #
|
||||||
|
# Maintainer: #
|
||||||
|
# TheFlyingFool - tff@theflyingfool.com #
|
||||||
|
# http://theflyingfool.com #
|
||||||
|
# https://git.theflyingfool.com/theflyingfool/dotfiles.git #
|
||||||
|
# #
|
||||||
|
##############################################################
|
||||||
|
|
||||||
|
# Skip erything for non-interactive shell
|
||||||
|
[[ -z "$PS1" ]] && return
|
||||||
|
|
||||||
|
# History
|
||||||
|
HISTFILE="$ZDOTDIR/.zsh_history"
|
||||||
|
HISTSIZE=100000000
|
||||||
|
SAVEHIST=50000000
|
||||||
|
setopt INC_APPEND_HISTORY
|
||||||
|
setopt sharehistory
|
||||||
|
setopt appendhistory
|
||||||
|
|
||||||
|
# Use Bitwarden as ssh_agent
|
||||||
|
export SSH_AUTH_SOCK="$HOME/.bitwarden-ssh-agent.sock"
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
source "$ZDOTDIR/.alias"
|
||||||
|
|
||||||
|
# Prompt
|
||||||
|
setopt prompt_subst
|
||||||
|
autoload -U colors && colors
|
||||||
|
|
||||||
|
# Change hostname color if using ssh
|
||||||
|
if [[ -n $SSH_CLIENT ]]; then
|
||||||
|
PROMPT="[%{$fg[yellow]%}%n%{$reset_color%}@%B%{$fg[red]%}%M%{$reset_color%}]%{$reset_color%}-%{$reset_color%}[%{$fg[green]%}%~%{$reset_color%}]
|
||||||
|
%#"
|
||||||
|
else
|
||||||
|
PROMPT="[%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[cyan]%}%M%{$reset_color%}]%{$reset_color%}-%{$reset_color%}[%{$fg[green]%}%~%{$reset_color%}]
|
||||||
|
%#"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Git branch info colors/symbols
|
||||||
|
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%}"
|
||||||
|
GIT_PROMPT_BEHIND="%{$fg[cyan]%}BNUM%{$reset_color%}"
|
||||||
|
GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡︎%{$reset_color%}"
|
||||||
|
GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
|
||||||
|
GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●%{$reset_color%}"
|
||||||
|
GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}"
|
||||||
|
|
||||||
|
# Show Git branch/tag, or name-rev if on detached head
|
||||||
|
parse_git_branch() {
|
||||||
|
(git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show different symbols as appropriate for various Git repository states
|
||||||
|
parse_git_state() {
|
||||||
|
|
||||||
|
# Compose this value via multiple conditional appends.
|
||||||
|
local GIT_STATE=""
|
||||||
|
|
||||||
|
local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')"
|
||||||
|
if [ "$NUM_AHEAD" -gt 0 ]; then
|
||||||
|
GIT_STATE="$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')"
|
||||||
|
if [ "$NUM_BEHIND" -gt 0 ]; then
|
||||||
|
GIT_STATE="$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)"
|
||||||
|
if [ -n "$GIT_DIR" ] && test -r "$GIT_DIR/MERGE_HEAD"; then
|
||||||
|
GIT_STATE="$GIT_STATE$GIT_PROMPT_MERGING"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$(git ls-files --other --exclude-standard 2> /dev/null)" ]]; then
|
||||||
|
GIT_STATE="$GIT_STATE$GIT_PROMPT_UNTRACKED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff --quiet 2> /dev/null; then
|
||||||
|
GIT_STATE="$GIT_STATE$GIT_PROMPT_MODIFIED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff --cached --quiet 2> /dev/null; then
|
||||||
|
GIT_STATE="$GIT_STATE$GIT_PROMPT_STAGED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$GIT_STATE" ]]; then
|
||||||
|
echo "$GIT_PROMPT_PREFIX$GIT_STATE$GIT_PROMPT_SUFFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# If inside a Git repository, print its branch and state
|
||||||
|
git_prompt_string() {
|
||||||
|
local git_where="$(parse_git_branch)"
|
||||||
|
[ -n "$git_where" ] && echo "$(parse_git_state)$GIT_PROMPT_PREFIX%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set the right-hand prompt
|
||||||
|
RPS1='$(git_prompt_string)'
|
Loading…
Reference in New Issue
Block a user