Compare commits
4 Commits
fa7af5ee1f
...
f7b5147450
| Author | SHA1 | Date | |
|---|---|---|---|
| f7b5147450 | |||
| 6246e75d81 | |||
| d901efe31a | |||
| e15f254143 |
@ -39,6 +39,13 @@ alias df="df -h"
|
|||||||
# Human readable file size inspection
|
# Human readable file size inspection
|
||||||
alias du="du -sh"
|
alias du="du -sh"
|
||||||
|
|
||||||
|
# History searches
|
||||||
|
alias hgrep='history | grep --color'
|
||||||
|
alias phgrep="cat ${PERSISTENT_HISTFILE} | grep --color"
|
||||||
|
|
||||||
|
alias hfzf='history | fzf'
|
||||||
|
alias phfzf="cat ${PERSISTENT_HISTFILE} | fzf"
|
||||||
|
|
||||||
|
|
||||||
#{- NETWORKING -}#
|
#{- NETWORKING -}#
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export HISTSIZE=-1
|
|||||||
#{- SHELL OPTIONS -}#
|
#{- SHELL OPTIONS -}#
|
||||||
|
|
||||||
# Append history to $HISTFILE when bash exits, instead of overwriting it
|
# Append history to $HISTFILE when bash exits, instead of overwriting it
|
||||||
shopt -s histappend
|
#shopt -s histappend
|
||||||
|
|
||||||
# Attempt to preserve multi-line commands in history with embedded newlines
|
# Attempt to preserve multi-line commands in history with embedded newlines
|
||||||
shopt -s cmdhist lithist
|
shopt -s cmdhist lithist
|
||||||
|
|||||||
29
bash/.bashrc
29
bash/.bashrc
@ -23,12 +23,31 @@ export PS4="${blue}#${no_color} "
|
|||||||
|
|
||||||
#{- HISTORY -}#
|
#{- HISTORY -}#
|
||||||
|
|
||||||
#shopt -s histappend
|
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||||
#export PROMPT_COMMAND="history -a; histroy -c; history -r; $PROMPT_COMMAND"
|
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
||||||
|
export HISTFILE="$HOME/.history/bash"
|
||||||
|
export HISTTIMEFORMAT="%F %T "
|
||||||
|
export HISTCONTROL="erasedups:ignoreboth"
|
||||||
|
export HISTFILESIZE=-1
|
||||||
|
export HISTSIZE=-1
|
||||||
|
|
||||||
export HISTCONTROL="ignoreboth:erasedups"
|
export PERSISTENT_HISTFILE="${HOME}/.persistent_history"
|
||||||
shopt -s histappend
|
log_bash_persistent_history()
|
||||||
export PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
{
|
||||||
|
local rc=$?
|
||||||
|
[[
|
||||||
|
$(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
|
||||||
|
]]
|
||||||
|
local date_part="${BASH_REMATCH[1]}"
|
||||||
|
local command_part="${BASH_REMATCH[2]}"
|
||||||
|
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
|
||||||
|
then
|
||||||
|
echo $date_part "|" "$rc" "|" "$command_part" >> "${PERSISTENT_HISTFILE}"
|
||||||
|
export PERSISTENT_HISTORY_LAST="$command_part"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||||
|
|
||||||
|
|
||||||
#{- SOURCING -}#
|
#{- SOURCING -}#
|
||||||
|
|||||||
@ -15,3 +15,9 @@ maths()
|
|||||||
{
|
{
|
||||||
bc -l <<< "scale=2; $*"
|
bc -l <<< "scale=2; $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cat_with_newline()
|
||||||
|
{
|
||||||
|
cat "$@" && echo
|
||||||
|
}
|
||||||
|
alias cat="cat_with_newline"
|
||||||
|
|||||||
@ -74,3 +74,10 @@ set keymap vi-insert
|
|||||||
Control-q: quoted-insert
|
Control-q: quoted-insert
|
||||||
Control-@: set-mark
|
Control-@: set-mark
|
||||||
Control-_: undo
|
Control-_: undo
|
||||||
|
"\e[A": history-search-backward
|
||||||
|
"\e[B": history-search-forward
|
||||||
|
set keymap vi-command
|
||||||
|
j: history-search-forward
|
||||||
|
k: history-search-backward
|
||||||
|
"\e[A": history-search-backward
|
||||||
|
"\e[B": history-search-forward
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user