-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from lambdaclan/feature/powershell-toolbox-imp…
…rovements feat: powershell toolbox improvements
- Loading branch information
Showing
4 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
az | ||
bat | ||
dotnet-8-sdk | ||
powershell | ||
eza | ||
fd | ||
fzf | ||
gawk | ||
jq | ||
ripgrep | ||
sed | ||
zoxide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Oh My Posh | ||
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/mt.omp.json' | Invoke-Expression | ||
|
||
# Zoxide | ||
Invoke-Expression (& { (zoxide init powershell | Out-String) }) | ||
|
||
# PSReadLine | ||
if ((Get-InstalledModule ` | ||
-Name "PSReadLine" ` | ||
-ErrorAction SilentlyContinue) -eq $null) { | ||
|
||
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted | ||
Install-Module -Name PSReadLine -AllowPrerelease -Force | ||
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Untrusted | ||
} | ||
|
||
# PSFzf | ||
if ((Get-InstalledModule ` | ||
-Name "PSFzf" ` | ||
-ErrorAction SilentlyContinue) -eq $null) { | ||
|
||
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted | ||
Install-Module -Name PSFzf | ||
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Untrusted | ||
} | ||
|
||
# Set PSReadLine options to show the history of typed commands | ||
Set-PSReadLineOption -PredictionSource History | ||
Set-PSReadLineOption -PredictionViewStyle ListView | ||
Set-PSReadLineOption -EditMode Windows | ||
|
||
# Set shortcuts to begin fzf searching | ||
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+f' | ||
|
||
# McFly | ||
Invoke-Expression -Command $(mcfly init powershell | Out-String) | ||
$env:MCFLY_RESULTS=50 | ||
# $env:MCFLY_RESULTS_SORT="LAST_RUN" # defaults to RANK | ||
# $env:MCFLY_LIGHT = "TRUE" | ||
|
||
# PowerShell parameter completion shim for the dotnet CLI | ||
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { | ||
param($commandName, $wordToComplete, $cursorPosition) | ||
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object { | ||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) | ||
} | ||
} | ||
|
||
# PowerShell parameter completion shim for Azure CLI | ||
Register-ArgumentCompleter -Native -CommandName az -ScriptBlock { | ||
param($commandName, $wordToComplete, $cursorPosition) | ||
$completion_file = New-TemporaryFile | ||
$env:ARGCOMPLETE_USE_TEMPFILES = 1 | ||
$env:_ARGCOMPLETE_STDOUT_FILENAME = $completion_file | ||
$env:COMP_LINE = $wordToComplete | ||
$env:COMP_POINT = $cursorPosition | ||
$env:_ARGCOMPLETE = 1 | ||
$env:_ARGCOMPLETE_SUPPRESS_SPACE = 0 | ||
$env:_ARGCOMPLETE_IFS = "`n" | ||
$env:_ARGCOMPLETE_SHELL = 'powershell' | ||
az 2>&1 | Out-Null | ||
Get-Content $completion_file | Sort-Object | ForEach-Object { | ||
[System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", $_) | ||
} | ||
Remove-Item $completion_file, Env:\_ARGCOMPLETE_STDOUT_FILENAME, Env:\ARGCOMPLETE_USE_TEMPFILES, Env:\COMP_LINE, Env:\COMP_POINT, Env:\_ARGCOMPLETE, Env:\_ARGCOMPLETE_SUPPRESS_SPACE, Env:\_ARGCOMPLETE_IFS, Env:\_ARGCOMPLETE_SHELL | ||
} |