Skip to content

Commit f2d05a9

Browse files
committed
refactor all history modifications into discrete plugins
1 parent 3addebb commit f2d05a9

File tree

5 files changed

+34
-20
lines changed

5 files changed

+34
-20
lines changed

clean_files.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ docs
2323
.gitattributes
2424
lint_clean_files.sh
2525

26+
# plugins
27+
#
28+
plugins/available/history.plugin.bash
29+
plugins/available/history-search.plugin.bash
30+
plugins/available/history-substring-search.plugin.bash
31+
2632
# themes
2733
#
2834
themes/90210

lib/history.bash

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cite about-plugin
2+
about-plugin 'search history using the prefix already entered'
3+
4+
# enter a few characters and press UpArrow/DownArrow
5+
# to search backwards/forwards through the history
6+
if [[ ${SHELLOPTS} =~ (vi|emacs) ]]; then
7+
bind '"\e[A":history-search-backward'
8+
bind '"\e[B":history-search-forward'
9+
fi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cite about-plugin
2+
about-plugin 'search history using the substring already entered'
3+
4+
# enter a few characters and press UpArrow/DownArrow
5+
# to search backwards/forwards through the history
6+
if [[ ${SHELLOPTS} =~ (vi|emacs) ]]; then
7+
bind '"\e[A":history-substring-search-backward'
8+
bind '"\e[B":history-substring-search-forward'
9+
fi
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
cite about-plugin
2-
about-plugin 'history manipulation'
3-
# enter a few characters and press UpArrow/DownArrow
4-
# to search backwards/forwards through the history
5-
if [[ ${SHELLOPTS} =~ (vi|emacs) ]]
6-
then
7-
bind '"":history-search-backward'
8-
bind '"":history-search-forward'
9-
fi
2+
about-plugin 'improve history handling with sane defaults'
3+
4+
# append to bash_history if Terminal.app quits
5+
shopt -s histappend
6+
7+
# erase duplicates; alternative option: export HISTCONTROL=ignoredups
8+
export HISTCONTROL=${HISTCONTROL:-ignorespace:erasedups}
9+
10+
# resize history to 100x the default (500)
11+
export HISTSIZE=${HISTSIZE:-50000}

0 commit comments

Comments
 (0)