Last active
October 23, 2021 07:15
-
-
Save ignatandrei/fe3fcf42717ab223ccc19453d88d054f to your computer and use it in GitHub Desktop.
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
# Install-Module Terminal-Icons | |
Import-Module -Name Terminal-Icons | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
#Set-PoshPrompt -Theme pararussel | |
#Set-PoshPrompt -Theme agnosterplus | |
Set-PoshPrompt -Theme powerlevel10k_lean | |
# https://ohmyposh.dev/docs/themes | |
function edit ($file) { & "${env:ProgramFiles}\Notepad++\notepad++.exe" $file } | |
function explore { "explorer.exe `"$(Get-Location)`"" | Invoke-Expression } | |
function rdp ($ip) { | |
Start-Process -FilePath mstsc -ArgumentList "/admin /w:1024 /h:768 /v:$ip" | |
} | |
# Install-Module -Name PowerShellGet -RequiredVersion 2.2.5 -Force -AllowClobber | |
# Install-Module PSReadLine -AllowPrerelease -Force | |
Import-Module PSReadLine | |
Set-PSReadLineOption -PredictionSource History | |
Set-PSReadLineOption -PredictionViewStyle ListView | |
Set-PSReadLineOption -EditMode Windows | |
#dotnet tool install --global dotnet-suggest --version 1.1.221601 | |
# dotnet suggest shell start | |
if (Get-Command "dotnet-suggest" -errorAction SilentlyContinue) | |
{ | |
$availableToComplete = (dotnet-suggest list) | Out-String | |
$availableToCompleteArray = $availableToComplete.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | |
Register-ArgumentCompleter -Native -CommandName $availableToCompleteArray -ScriptBlock { | |
param($wordToComplete, $commandAst, $cursorPosition) | |
$fullpath = (Get-Command $commandAst.CommandElements[0]).Source | |
$arguments = $commandAst.Extent.ToString().Replace('"', '\"') | |
dotnet-suggest get -e $fullpath --position $cursorPosition -- "$arguments" | ForEach-Object { | |
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) | |
} | |
} | |
} | |
else | |
{ | |
"Unable to provide System.CommandLine tab completion support unless the [dotnet-suggest] tool is first installed." | |
"See the following for tool installation: https://www.nuget.org/packages/dotnet-suggest" | |
} | |
# 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', $_) | |
} | |
} | |
$env:DOTNET_SUGGEST_SCRIPT_VERSION = "1.0.2" | |
# dotnet suggest script end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment