mirror of
https://github.com/Matir/skel.git
synced 2026-07-24 21:26:57 -07:00
Optimize startup
This commit is contained in:
@@ -29,10 +29,7 @@ fi
|
|||||||
|
|
||||||
# Setup for libvirt
|
# Setup for libvirt
|
||||||
if [ -z "${LIBVIRT_DEFAULT_URI:-}" ] ; then
|
if [ -z "${LIBVIRT_DEFAULT_URI:-}" ] ; then
|
||||||
if [ "$(id -u)" = "0" ] || (id -Gn 2>/dev/null | grep -q "\blibvirt\b") ; then
|
export LIBVIRT_DEFAULT_URI="qemu:///system"
|
||||||
LIBVIRT_DEFAULT_URI="qemu:///system"
|
|
||||||
export LIBVIRT_DEFAULT_URI
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Got rust? (gvim, etc.)
|
# Got rust? (gvim, etc.)
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ export WORKON_HOME="$HOME/.virtualenvs"
|
|||||||
# GPG full key id
|
# GPG full key id
|
||||||
export GPG_ID=7FD58D9A196DCEEEAD671F94F4D7A7915DEA789B
|
export GPG_ID=7FD58D9A196DCEEEAD671F94F4D7A7915DEA789B
|
||||||
|
|
||||||
|
# Capture uname early
|
||||||
|
_UNAME="$(uname)"
|
||||||
|
|
||||||
# things we need in all interactive shells
|
# things we need in all interactive shells
|
||||||
case "$-" in
|
case "$-" in
|
||||||
*i*)
|
*i*)
|
||||||
@@ -86,7 +89,6 @@ case "$-" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Opt out of .net telemetry
|
# Opt out of .net telemetry
|
||||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
|
|
||||||
@@ -254,7 +256,7 @@ esac
|
|||||||
|
|
||||||
# Setup XDG-like dirs on MacOS
|
# Setup XDG-like dirs on MacOS
|
||||||
# Based on https://leebyron.com/til/mac-xdg/
|
# Based on https://leebyron.com/til/mac-xdg/
|
||||||
if [ "$(uname)" = "Darwin" ] ; then
|
if [ "${_UNAME}" = "Darwin" ] ; then
|
||||||
export XDG_BIN_HOME="${XDG_BIN_HOME:-$HOME/.local/bin}"
|
export XDG_BIN_HOME="${XDG_BIN_HOME:-$HOME/.local/bin}"
|
||||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/Library/Caches}"
|
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/Library/Caches}"
|
||||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
@@ -263,10 +265,12 @@ if [ "$(uname)" = "Darwin" ] ; then
|
|||||||
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$TMPDIR/runtime-$(id -u)}"
|
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$TMPDIR/runtime-$(id -u)}"
|
||||||
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||||
export PATH="${HOME}/bin/macos:${PATH}"
|
export PATH="${HOME}/bin/macos:${PATH}"
|
||||||
elif [ "$(uname)" = "Linux" ] ; then
|
elif [ "${_UNAME}" = "Linux" ] ; then
|
||||||
export PATH="${HOME}/bin/linux:${PATH}"
|
export PATH="${HOME}/bin/linux:${PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset _UNAME
|
||||||
|
|
||||||
if test -e "$HOME/.localenv"; then
|
if test -e "$HOME/.localenv"; then
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. "$HOME/.localenv"
|
. "$HOME/.localenv"
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
# For interactive shells
|
# For interactive shells
|
||||||
[[ -n "$ZSH_PROFILE" ]] && {
|
[[ -n "$ZSH_PROFILE" ]] && {
|
||||||
zmodload zsh/datetime
|
zmodload zsh/datetime
|
||||||
zshrc_start_time=$EPOCHREALTIME
|
|
||||||
zmodload zsh/zprof
|
zmodload zsh/zprof
|
||||||
|
export PS4='+[%D{%f} / %D{%s.%N}] %N:%i> '
|
||||||
|
exec 3>&2 2>/tmp/zsh_startup.log
|
||||||
|
set -x
|
||||||
|
zshrc_start_time=$EPOCHREALTIME
|
||||||
}
|
}
|
||||||
HISTFILE=~/.zhistory
|
HISTFILE=~/.zhistory
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
@@ -298,6 +301,8 @@ typeset -U PATH
|
|||||||
|
|
||||||
if [[ -n "$ZSH_PROFILE" ]]; then
|
if [[ -n "$ZSH_PROFILE" ]]; then
|
||||||
zshrc_end_time=$EPOCHREALTIME
|
zshrc_end_time=$EPOCHREALTIME
|
||||||
|
set +x
|
||||||
|
exec 2>&3 3>&-
|
||||||
# Calculation in ms using zsh floating point math
|
# Calculation in ms using zsh floating point math
|
||||||
elapsed_ms=$(( (zshrc_end_time - zshrc_start_time) * 1000 ))
|
elapsed_ms=$(( (zshrc_end_time - zshrc_start_time) * 1000 ))
|
||||||
printf "zshrc done: %.0fms\n" "$elapsed_ms"
|
printf "zshrc done: %.0fms\n" "$elapsed_ms"
|
||||||
|
|||||||
Reference in New Issue
Block a user