Skip to content

Latest commit

 

History

History
84 lines (65 loc) · 2.32 KB

README.md

File metadata and controls

84 lines (65 loc) · 2.32 KB

PowerShell Configuration

This guide will help you configure PowerShell inspired by this blog post.

Install Zoxide

winget install ajeetdsouza.zoxide

install oh-my-posh

winget install JanDeDobbeleer.OhMyPosh -s winget

install nerd font

oh-my-posh font install 

select cascady cove and change the font in powershell

edit powershell profile to use oh-my-posh

code $PROFILE

Initialize Oh My Posh with the theme which we chosen

oh-my-posh init pwsh --config ""$env:POSH_THEMES_PATH\kushal.omp.json" | Invoke-Expression

Install terminal file manager

winget install --id=antonmedv.walk  -e

Install tldr-pages

winget install tldr

Edit Your Profile to Look Like This

# Initialize Oh My Posh with the theme which we chosen
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\kushal.omp.json" | Invoke-Expression

# Set some useful Alias to shorten typing and save some key stroke 
Set-Alias ll ls 
Set-Alias grep findstr

# Set Some Option for PSReadLine to show the history of our typed commands
Set-PSReadLineOption -PredictionSource History 
Set-PSReadLineOption -PredictionViewStyle ListView 
Set-PSReadLineOption -EditMode Windows 

# enable zoxide
Invoke-Expression (& { (zoxide init powershell | Out-String) })

# replace 'Ctrl+t' and 'Ctrl+r' with your preferred bindings:
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'


# ----------------------------------------Functions ----------------------------------------------

# move in selected directory using walk
function lk() {clear | z $(walk --icons $args)}

# list json files in a folder
function Get-JsonFileList {
    param(
        [Parameter(Mandatory=$false)]
        [string]$Path = "."
    )

    Get-ChildItem -Path $Path -Filter "*.json" | ForEach-Object {
        $_.BaseName >> json_file_list.txt
    }
}

# Utility Command that tells you where the absolute path of commandlets are 
function which ($command) { 
 Get-Command -Name $command -ErrorAction SilentlyContinue | 
 Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue 
}