mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-30 16:10:45 +00:00
zsh: skip mkdir history directory when it exists
Every interactive shell ran `mkdir -p "$(dirname "$HISTFILE")"`, which forks twice, even though the directory almost always exists. It costs ~10ms on macOS 27. We now test if the directory exists first and use zsh's `:h` modifier instead of dirname, so the most of the time no processes are started. The directory is still created when missing.
This commit is contained in:
committed by
Austin Horstman
parent
1e3ebeb683
commit
095fef2f26
@@ -218,7 +218,7 @@ in
|
||||
cfg.history.ignorePatterns != [ ]
|
||||
) "HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" cfg.history.ignorePatterns})"}"}
|
||||
HISTFILE="${mkShellVarPathStr cfg.history.path}"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
[[ -d ''${HISTFILE:h} ]] || mkdir -p "''${HISTFILE:h}"
|
||||
'')
|
||||
|
||||
(lib.mkIf (cfg.historySubstringSearch.enable or false) (
|
||||
|
||||
@@ -12,7 +12,7 @@ HISTSIZE="10000"
|
||||
SAVEHIST="10000"
|
||||
|
||||
HISTFILE="/home/hm-user/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
[[ -d ${HISTFILE:h} ]] || mkdir -p "${HISTFILE:h}"
|
||||
|
||||
# Set shell options
|
||||
set_opts=(
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
SAVEHIST="10000"
|
||||
|
||||
HISTFILE="/home/hm-user/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
[[ -d ''${HISTFILE:h} ]] || mkdir -p "''${HISTFILE:h}"
|
||||
|
||||
# Set shell options
|
||||
set_opts=(
|
||||
|
||||
@@ -12,7 +12,7 @@ HISTSIZE="10000"
|
||||
SAVEHIST="10000"
|
||||
|
||||
HISTFILE="/home/hm-user/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
[[ -d ${HISTFILE:h} ]] || mkdir -p "${HISTFILE:h}"
|
||||
|
||||
# Set shell options
|
||||
set_opts=(
|
||||
|
||||
@@ -12,7 +12,7 @@ HISTSIZE="50000"
|
||||
SAVEHIST="50000"
|
||||
|
||||
HISTFILE="/home/hm-user/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
[[ -d ${HISTFILE:h} ]] || mkdir -p "${HISTFILE:h}"
|
||||
|
||||
# Set shell options
|
||||
set_opts=(
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
SAVEHIST="10000"
|
||||
|
||||
HISTFILE="/home/hm-user/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
[[ -d ''${HISTFILE:h} ]] || mkdir -p "''${HISTFILE:h}"
|
||||
|
||||
# Set shell options
|
||||
set_opts=(
|
||||
|
||||
Reference in New Issue
Block a user