From 54e79843eee621c86a70fbef4681853e6395e5ac Mon Sep 17 00:00:00 2001 From: James Dixon Date: Mon, 20 Jul 2020 15:41:14 -0400 Subject: [PATCH] add rcdiff function --- bash/bashrc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/bash/bashrc b/bash/bashrc index e6bf88b..c4c17f7 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -128,7 +128,7 @@ tma() { fi } -# paths and files +# path management pathappend() { # https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there for ARG; do @@ -142,12 +142,43 @@ pathappend() { done } -bkup() { if [ -f "$1" ]; then cp "${1}" "${1}.bkup.$(date +'%F.%R')"; fi } +# easy backup +bkup() { + if [ -f "$1" ]; then + cp "${1}" "${1}.bkup.$(date +'%F.%R')"; + fi +} + +# easy diff rc files in home and in dotfile repo +rcdiff() { + if [ "$#" -lt 1 ]; then + echo "Please specify rc to diff" + fi + + if [ "$1" == "vim" ]; then + vimdiff "$HOME/.vim/vimrc" "$DF/vim/vimrc" + fi + + if [ "$1" == "bash" ]; then + vimdiff "$HOME/.bashrc" "$DF/bash/bashrc" + fi + + if [ "$1" == "git" ]; then + vimdiff "$HOME/.gitconfig" "$DF/git/gitconfig" + fi + + if [ "$1" == "tmux" ]; then + vimdiff "$HOME/.tmux.conf" "$DF/tmux/tmux.conf" + fi +} # git lazygit() { git commit -a -m "$*" && git push; } lg() { lazygit "$*"; } +# PROMPTS +# ------- + # git prompt function parse_git() { BRANCH="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"