Last active
August 29, 2015 14:05
-
-
Save kminiatures/4f8ed173dbc605b70413 to your computer and use it in GitHub Desktop.
incremental search for history using peco.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco-hist() { | |
time_column=`echo $HISTTIMEFORMAT | awk '{printf("%s",NF)}'` | |
column=`expr $time_column + 3` | |
cmd=`history | tac | peco | sed -e 38;5;208m's/^ //' | sed -e 's/ +/ /g' | cut -d " " -f $column-` | |
history -s "$cmd" | |
eval $cmd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment