commit 27bdf8bca13c1b77a76c81b89ddb5563567988a2
parent 585db821694da090cada325e5e2a793b1416c3b2
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Mon, 16 Aug 2021 15:17:41 +0530
Merge pull request #10 from bharatvaj/bharat-9052
Add missing .config/bash/plugin files
Diffstat:
4 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/.config/.gitignore b/.config/.gitignore
@@ -1,4 +1,4 @@
-Ignore everything by default.
+# Ignore everything by default.
*
!.gitignore
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