dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit e04c329a76e8f9c3174090092d40dd124c1ac3e3
parent 56261cddedafe4ea01a9ea09ea0dfac49823fd68
Author: Bharatvaj H <bharatvaj@yahoo.com>
Date:   Mon, 16 Aug 2021 15:16:50 +0530

Added plugins

Diffstat:
M.config/bash/bashrc | 4++--
A.config/bash/plugin/git | 43+++++++++++++++++++++++++++++++++++++++++++
A.config/bash/plugin/index | 13+++++++++++++
3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/.config/bash/bashrc b/.config/bash/bashrc @@ -15,8 +15,8 @@ done export PS1="\w $ " -# Source plugin index -source "${XDG_CONFIG_HOME}/bash/plugin/index" +# Plugins +[ -f "${XDG_CONFIG_HOME}/bash/plugin/index" ] && . "${XDG_CONFIG_HOME}/bash/plugin/index" # Aliases [ -f "${XDG_CONFIG_HOME}/bash/aliases" ] && . "${XDG_CONFIG_HOME}"/bash/aliases diff --git a/.config/bash/plugin/git b/.config/bash/plugin/git @@ -0,0 +1,43 @@ +# ---------------------- +# Git Aliases +# ---------------------- +alias ga='git add' +alias gaa='git add .' +alias gaaa='git add --all' +alias gau='git add --update' +alias gb='git branch' +alias gbd='git branch --delete ' +alias gc='git commit' +alias gcm='git commit --message' +alias gcf='git commit --fixup' +alias gco='git checkout' +alias gcob='git checkout -b' +alias gcom='git checkout master' +alias gcos='git checkout staging' +alias gcod='git checkout develop' +alias gd='git diff' +alias gda='git diff HEAD' +alias gi='git init' +alias glg='git log --graph --oneline --decorate --all' +alias gld='git log --pretty=format:"%h %ad %s" --date=short --all' +alias gm='git merge --no-ff' +alias gma='git merge --abort' +alias gmc='git merge --continue' +alias gp='git pull' +alias gpr='git pull --rebase' +alias gr='git rebase' +alias gs='git status' +alias gss='git status --short' +alias gst='git stash' +alias gsta='git stash apply' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gsts='git stash save' + +# ---------------------- +# Git Functions +# ---------------------- +# Git log find by commit message +function glf() { git log --all --grep="$1"; } + diff --git a/.config/bash/plugin/index b/.config/bash/plugin/index @@ -0,0 +1,13 @@ +# Plugins should be sourced from this file +# Instead of hardcoding in bashrc file +# TODO Generalize this(remove bashisms), so we can use this in other shells + +BASH_PLUGIN_DIR="${XDG_CONFIG_HOME}/bash/plugin" + +function bashplug() { + plugin_file="${BASH_PLUGIN_DIR}/$1" + [ -f ${plugin_file} ] && . "${plugin_file}" +} + +# Enable this plugin if 'git' is installed +which git >&/dev/null && bashplug git