# SYNOPSIS
#   refresh
#
# OVERVIEW
#   Refresh (reload) the current fish session.

function refresh -d "refresh the fish session"
  set -q CI; or exec fish < /dev/tty
end

# SYNOPSIS
#   refresh
#
# OVERVIEW
#   Refresh (reload) the current fish session.

function refresh -d "Refresh fish session by replacing current process"
  if not set -q CI
    history --save
    exec fish < /dev/tty
  end
end

Save history before replacing shell process
Save history before replacing shell process

Fixes an issue with history between shell reloads via refresh function call.
As `exec` replaces the current process in a non-gently fashion, the
persistent history could be out of sync with the in-memory history.

Calling `history --save` before `exec` should force the shell to persist the
history before replacing the current process.

eugenesvk/oh-my-fish,sheldon/oh-my-fish,oh-my-fish/oh-my-fish,jeremiejig/oh-my-fish,lfiolhais/oh-my-fish,wfscheper/oh-my-fish,wangyung/oh-my-fish,wfscheper/oh-my-fish,bsott/oh-my-fish,scorphus/oh-my-fish,oranja/oh-my-fish,nwykes/oh-my-fish,wangyung/oh-my-fish,bsott/oh-my-fish,oranja/oh-my-fish,Pyppe/oh-my-fish,MaicoTimmerman/oh-my-fish,MaicoTimmerman/oh-my-fish,hfs/oh-my-fish,bobthecow/oh-my-fish,oh-my-fish/oh-my-fish,lfiolhais/oh-my-fish,hfs/oh-my-fish,nwykes/oh-my-fish,scorphus/oh-my-fish,jeremiejig/oh-my-fish,eugenesvk/oh-my-fish