summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-06-13 15:46:05 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-06-13 15:46:05 +0200
commit27620d0cf29fce5a636ba84156011bd022c3b7d3 (patch)
tree4f9aac9229fa7f205e72affdde8e58a41b361bb2
parentf2222e1cfbac08fd3863692da4d3155208ed8fe4 (diff)
downloaddotfiles-27620d0cf29fce5a636ba84156011bd022c3b7d3.tar.gz
dotfiles-27620d0cf29fce5a636ba84156011bd022c3b7d3.tar.xz
dotfiles-27620d0cf29fce5a636ba84156011bd022c3b7d3.zip
Bash config: add hist-grep func (+ hist-del-last helper alias)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--.bashrc25
1 files changed, 20 insertions, 5 deletions
diff --git a/.bashrc b/.bashrc
index 653efa2..942a38b 100644
--- a/.bashrc
+++ b/.bashrc
@@ -15,12 +15,29 @@ HISTCONTROL=ignoreboth
PROMPT_COMMAND='(history -a)'
PS1='\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
+# op(t)inioned commands
alias mc='LESS="-RSX" mc'
alias tmux='tmux -2'
+# debug, etc.
+alias hist-del-last='history -d $(history 1 | cut -d" " -f2)' # historical NOOP
+
+# proper aliases
alias gmy="pushd ~/wrkspc/gmy >/dev/null"
alias gwork="pushd ~/wrkspc/gwork >/dev/null"
+
+# debug, etc.
+
+debug-argsep () {
+ while [ $# -ne 0 ]; do
+ echo $1;
+ shift
+ done
+}
+
+# proper functions
+
cdup () {
local up="."
for i in $(seq 1 $1); do up+="/.."; done
@@ -45,9 +62,7 @@ ack-intersection () {
comm <(ack -al --follow "Topic" | sort) <(ack -al --follow "news" | sort) -12
}
-debug-argsep () {
- while [ $# -ne 0 ]; do
- echo $1;
- shift
- done
+hist-grep () {
+ hist-del-last # omit hist-grep invocation
+ grep $* -- ~/.bash_history
}