Skip to content

redjax/PowershellProfile

Repository files navigation

Powershell Profile

Created At Last Commit Commits this year Repo size

My Powershell $PROFILE module.

📖 Documentation


Warning

This script overwrites your Powershell $PROFILE. Make sure to take a backup of that before running any of the scripts in this repository, especially if you've done any customization previously.

You can backup your current profile with:

Copy-Item -Path "$($PROFILE)" -Destination "$($PROFILE).orig"

To restore it later, run:

Copy-Item -Path "$($PROFILE).orig" -Destination "$($Profile)"

Table of Contents

Description

My PowerShell $PROFILE is modular and component based. It will intelligently load functionality based on what is currently installed/configured on a machine, and the options used when running the install script.

By default the profile customizes the $PROMPT and adds custom functions, aliases, and handles third-party software initialization and shell completions.

This profile is highly specific to my preferences and tooling. It supports Oh-My-Posh and Starship shells, and has custom PowerShell readline handlers to improve efficiency and make PowerShell a little more pleasant to use.

The profiling script shows the initialization steps the profile takes, enabling troubleshooting when the profile takes a long time to load.

The profile starts in ~530ms on a machine with antivirus installed. It is nearly instant on machines with no antivirus. I have spent a lot of time profiling and optimizing the startup sequence for the profile so I'm not waiting at my prompt for things to finish initializing.

Install

Note

These instructions assume you are installing the monolith profile.

Option 1: Clone the repository

  • Clone the repository with git clone https://github.com/redjax/PowershellProfile.git (or via SSH with git clone git@github.com:redjax/PowershellProfile.git)
  • cd into the PowershellProfile\ directory
  • Run .\Install-MonoProfile.ps1 -Prompt default -Force
    • See usage/help menu with Get-Help .\Install-MonoProfile.ps1 -Detailed

Option 2: Download a release

  • Download a release from the releases page
  • Extract the archive somewhere on your machine
  • Run the included Install-MonoProfile.ps1 script
    • To see install script usage, run Get-Help .\Install-MonoProfile.ps1 -Detailed

Usage

To see a unified list of both functions and aliases exported by this profile, run: Show-ProfileFunctions.

To see a full list of the functions exported by this profile, run: Show-ProfileModuleFunctions.

To see a full list of the aliases exported by this profile, run: Show-ProfileModuleAliases.

Custom Modules

This repository includes a number of custom modules in the Modules/Custom path. These modules can add additional functionality to your $PROFILE, like providing Unix-like aliases (i.e. which -> where), networking utility functions, and some fun ones like a module for checking the weather.

Remove custom modules

Run the Remove-CustomModulesDir.ps1 script to uninstall all custom modules. This does not affect your custom profile, only the modules in the profile path's CustomModules/ directory.

Developing

See the Developing docs

Notes

See the Notes documentation pages

Links

Check the docs for useful links