summaryrefslogtreecommitdiff
path: root/dot_config/powershell/Microsoft.PowerShell_profile.ps1
blob: 11e43d28772e1d5c74aeb05b9ff1dce570e3b8e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Environment variables
$env:XDG_CONFIG_HOME="C:/Users/muftei/.config"
$env:XDG_DATA_HOME="C:/Users/muftei/.local/share"
$env:XDG_STATE_HOME="C:/Users/muftei/.local/state"
$env:EDITOR="nvim"

# Use some cool icons
Import-Module -Name Terminal-Icons

# Git autocompletion for Powershell
Import-Module -Name posh-git

# Fuzzy find my project files
Set-PSReadlineKeyHandler -Key "Ctrl+f" -ScriptBlock {
        $codepath = $(Join-Path "C:" $env:HOMEPATH "\Documents\Repos\")
        $configpath = $(Join-Path "C:" $env:HOMEPATH "\.config\")
        $localsharepath = $(Join-Path "C:" $env:HOMEPATH "\.local\share\")
        $obsidianvaultpath = $(Join-Path "C:" $env:HOMEPATH "\Documents\Vaults\")
        Invoke-Expression "cd $(fd . $codepath $localsharepath $configpath $obsidianvaultpath -t d -d 1 | fzf)"

        # Next two lines sends an 'enter' key
        Add-Type -AssemblyName System.Windows.Forms
        [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
}

# Load Starship prompt
Invoke-Expression (&starship init powershell)