This commit is contained in:
Andrew Davidson 2023-01-14 13:23:48 -08:00
commit a70c27ed97
3 changed files with 64 additions and 13 deletions

View file

@ -66,9 +66,41 @@ sh_yellow="\[\033[1;33m\]"
sh_light_gray="\[\033[0;37m\]"
sh_white="\[\033[1;37m\]"
function git_prompt {
PCHANGED=""
PAHEAD=""
PBEHIND=""
local FULL_BRANCH="$(git symbolic-ref -q HEAD 2>/dev/null || git name-rev --name-only --no-undefined --always HEAD 2>/dev/null)"
PBRANCH="$(echo $FULL_BRANCH | sed 's/refs\/heads\///')"
if [ -n $PBRANCH ]; then
echo -n "${PBRANCH} "
# Are there unstaged changes in the working directory
local CHANGED=$(git status --porcelain --ignore-submodule -unormal 2>/dev/null | wc -l)
if [ $CHANGED -gt 0 ]; then
PCHANGED="◊"
fi
# Are we behind the origin?
local NUM_BEHIND="$(git log --oneline ..@{u} 2>/dev/null | wc -l | tr -d ' ' )"
if [ "$NUM_BEHIND" -gt 0 ]; then
PBEHIND="↓"
fi
# Are we ahead of the origin?
local NUM_AHEAD="$(git log --oneline @{u}.. 2>/dev/null | wc -l | tr -d ' ')"
if [ "$NUM_AHEAD" -gt 0 ]; then
PAHEAD="↑"
fi
if [[ -n $PCHANGED || -n $PAHEAD || -n $PBEHIND ]]; then
echo -n "${PCHANGED}${PBEHIND}${PAHEAD}"
fi
fi
}
# Make a pretty prompt.
export PROMPT_COMMAND='history -a; if [ $? -ne 0 ];then ERROR_FLAG=1;else ERROR_FLAG=;fi;'
export PS1=${HOSTCOLOUR}${sh_light_gray}'\t | \h'${sh_green}':\w'${sh_light_gray}' '${sh_light_gray}'${ERROR_FLAG:+'${sh_light_red}'}\$ '${sh_norm}
export PS1=${HOSTCOLOUR}${sh_light_gray}'\t | \h'${sh_green}':\w'${sh_light_gray}' $(git_prompt)'${sh_light_gray}'${ERROR_FLAG:+'${sh_light_red}'}\$ '${sh_norm}
# New files and folders should not be world readable
umask 0027
@ -133,16 +165,16 @@ alias e="exit"
alias g="grep --color=auto -i "
# shorter ls
alias l="ls -G"
alias l="ls -G --color"
# list files with details
alias ll="ls -lh"
alias ll="ls -lh --color"
# list all files.
alias la="ls -alh"
alias la="ls -alh --color"
# List directories.
alias ld="ls -Gd */"
alias ld="ls --color -Gd */"
# add some color to grep.
alias grep="grep --color=auto"
@ -238,8 +270,11 @@ function mt {
# Debian
if [ -d /usr/share/doc/fzf/examples ]; then
source /usr/share/doc/fzf/examples/key-bindings.bash
if [ -f /usr/share/doc/fzf/examples/completion.bash ]; then
source /usr/share/doc/fzf/examples/completion.bash
fi
fi
# MacOS
if [ -d /opt/homebrew/opt/fzf/shell ]; then

View file

@ -1,19 +1,22 @@
[user]
name = Andrew Davidson
email = andrew@amdavidson.com
signingkey = 17AF8F2A49CF25C6
email = andrew@andr3w.net
signingkey = F1199FC0A76BB402
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
@ -24,13 +27,17 @@
diff = auto
status = auto
branch = auto
[color "diff"]
whitespace = red reverse
[core]
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
[alias]
lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
[push]
default = simple
@ -38,8 +45,15 @@
plus-color = "#012800"
minus-color = "#340001"
syntax-theme = Monokai Extended
[interactive]
diffFilter = delta --color-only
[commit]
gpgsign = false
gpgsign = true
[credential]
helper = store
[init]
defaultBranch = main

View file

@ -50,6 +50,8 @@ autocmd BufWritePre *.py execute ':Black'
" Smart Line Numbers
Plug 'myusuf3/numbers.vim'
Plug 'tpope/vim-commentary'
call plug#end()
" ==================== Vim Settings ====================