powershell
PowerShell
Installation#
Usage#
-Force is the counterpart to Unix -A: it makes la list hidden and system entries.
No ll is defined — PowerShell never had one, and cross-platform alignment only covers
the command actually typed.
Git no longer goes through the posh-git / git-aliases modules — the functions are defined
by hand instead, see the git page.
Speeding Up Startup#
Nearly all of the profile's cost is spawning subprocesses. Measured medians of
pwsh -Command "exit":
starship gets launched twice#
starship init powershell prints exactly one line:
So running it launches starship a second time. Ask for the full script directly and cache it to a file, which removes that whole round trip:
Regeneration keys off the binary's LastWriteTime, so a winget upgrade refreshes the cache
on its own — no manual clearing.
The dot-source has to sit at the top level of the profile. Wrap this in a function and
. $__f only applies inside that function's scope: the prompt never reaches global scope, and
the symptom is "the cache ran but the prompt didn't change".
mise's completion script is cached the same way, but it must come after mise activate —
the completions shell out to usage at runtime, and usage is itself a mise-managed tool that
is not on PATH before activation, so every new shell would print usage CLI not found. See the
mise page.
The part that cannot be reduced#
The single Set-PSReadlineKeyHandler line costs about 183 ms, which is really the first load
of the PSReadLine module, not the key binding. An interactive session loads that module
anyway, so moving or deferring the line just pushes the cost to the first keystroke — it does
not feel faster.
mise activate cannot be cached either: it has to run every time to resolve versions for the
current session and install the directory-change hook.