-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfile.ps1
More file actions
47 lines (41 loc) · 1.91 KB
/
Profile.ps1
File metadata and controls
47 lines (41 loc) · 1.91 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Documents folder are moved to OneDrive
$documentsPath = [Environment]::GetFolderPath('MyDocuments')
# https://github.com/PowerShell/PowerShell/issues/15552
Import-Module -Name (Get-ChildItem $documentsPath\PowerShell\Modules)
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\pure.omp.json" | Invoke-Expression
# No more cursor blinking https://github.com/microsoft/terminal/issues/1379#issuecomment-821825557 https://github.com/fish-shell/fish-shell/issues/3741#issuecomment-273209823 https://github.com/microsoft/terminal/issues/1379
Write-Output "`e[6 q"
# Toggle for hypervisor boot
function hypervisorboot_toggle {
$currentState = (gsudo bcdedit /enum) -match 'hypervisorlaunchtype' -replace 'hypervisorlaunchtype\s+'
if ($currentState -eq 'Off') {
Write-Output "Enabling Hyper-V..."
gsudo bcdedit /set hypervisorlaunchtype auto
}
else {
Write-Output "Disabling Hyper-V..."
gsudo bcdedit /set hypervisorlaunchtype off
}
}
function YoutubeMarkWatched { yt-dlp --skip-download --mark-watched --cookies-from-browser=firefox $args }
function mkd {
$newDir = $args[0]
if (-not (Test-Path $newDir)) {
mkdir $newDir | Out-Null
}
Set-Location (Join-Path $PWD $newDir)
}
# Mirroring linux shells bindings and completion menu
# TODO: set this as default? https://github.com/PowerShell/PowerShell
Set-PSReadlineKeyHandler -Key Ctrl+a -Function BeginningOfLine
Set-PSReadlineKeyHandler -Key Ctrl+e -Function EndOfLine
# https://dev.to/ofhouse/add-a-bash-like-autocomplete-to-your-powershell-4257
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineKeyHandler -Key UpArrow -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::HistorySearchBackward()
[Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine()
}
Set-PSReadLineKeyHandler -Key DownArrow -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::HistorySearchForward()
[Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine()
}