mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-23 00:34:27 +01:00
Avoid performance hit caused by pre-saving by presaving in the background
This commit is contained in:
parent
1ab61f1d7d
commit
1d7ba41289
@ -2,7 +2,8 @@ function _hishtory_post_exec --on-event fish_preexec
|
||||
# Runs after <ENTER>, but before the command is executed
|
||||
set --global _hishtory_command $argv
|
||||
set --global _hishtory_start_time (date +%s)
|
||||
hishtory presaveHistoryEntry bash "$_hishtory_command" $_hishtory_start_time
|
||||
hishtory presaveHistoryEntry bash "$_hishtory_command" $_hishtory_start_time & # Background Run
|
||||
# hishtory presaveHistoryEntry bash "$_hishtory_command" $_hishtory_start_time # Foreground Run
|
||||
end
|
||||
|
||||
set --global _hishtory_first_prompt 1
|
||||
|
@ -15,7 +15,8 @@ function __hishtory_precommand() {
|
||||
# Run before every command
|
||||
HISHTORY_START_TIME=`date +%s`
|
||||
if ! [ -z "BASH_COMMAND " ] && [ "$BASH_COMMAND" != "__hishtory_postcommand" ]; then
|
||||
hishtory presaveHistoryEntry bash "$BASH_COMMAND" $HISHTORY_START_TIME
|
||||
(hishtory presaveHistoryEntry bash "$BASH_COMMAND" $HISHTORY_START_TIME &) # Background Run
|
||||
# hishtory presaveHistoryEntry bash "$BASH_COMMAND" $HISHTORY_START_TIME # Foreground Run
|
||||
fi
|
||||
}
|
||||
trap "__hishtory_precommand" DEBUG
|
||||
|
@ -10,7 +10,8 @@ function _hishtory_add() {
|
||||
_hishtory_command=$1
|
||||
_hishtory_start_time=`date +%s`
|
||||
if ! [ -z "$_hishtory_command " ]; then
|
||||
hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time
|
||||
(hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time &) # Background Run
|
||||
# hishtory presaveHistoryEntry zsh "$_hishtory_command" $_hishtory_start_time # Foreground Run
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user