Skip to content

Commit

Permalink
Avoid to save several history in PowerShell
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Aug 26, 2023
1 parent a45dfb4 commit 0fc0c07
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions windows/config/Profile.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Enable ctrl+a, ctrl+e
Set-PSReadLineOption -EditMode Emacs
Set-PSReadlineOption -BellStyle None
Set-PSReadLineOption –HistoryNoDuplicates:$True

Set-PSReadlineOption -AddToHistoryHandler {
param ($command)
switch -regex ($command) {
"winget install" {return $false}
"^[a-z]$" {return $false}
"exit" {return $false}
}
return $true
}

# https://github.com/microsoft/winget-cli/issues/2498#issuecomment-1553863082
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Expand Down

0 comments on commit 0fc0c07

Please sign in to comment.