https://discord.umbraco.com logo
#social
Title
# social
s

Sebastiaan

03/03/2022, 2:50 PM
The most important things to know are
notepad $PROFILE
is where you start adding stuff to load when your powershell loads and reloading is done with
. $PROFILE
And then it's a question of finding a posh theme that suits you and start customizing it by doing
Export-PoshTheme
as noted in their docs
n

Nik

03/04/2022, 10:07 AM
Ohh this is cool... what does the "Prediction source" stuff do and the Edit Mode stuff?
s

Sebastiaan

03/04/2022, 10:25 AM
So we're seeing here.. custom icons and colors in the directory listings, predictive autocomplete from historic commands, which is SUPER useful, these are all the things I do very often, no need to type it all out again. Not seen are the keyboard shortcuts, but speak for themselves.. CTRL+F5 to type
dotnet run
+ Enter in the current window, also very useful!
Also bottom pane has the current node version on the right side, the top one the current dotnet version, this is context aware.
m

Matt Wise

03/04/2022, 10:44 AM
You can do code $profile so you get powershell syntax highlighting instead of notepad
s

Sebastiaan

03/04/2022, 11:16 AM
Yeah true! Much nicer indeed
Actually don't know what the edit mode was...maybe that was part Needed for the keyboard ahortcuts
n

Nik

03/04/2022, 11:42 AM
Ohh nice, I have a couple of things that might be helpful as well:
Copy code
# 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', $_)
        }
}
Up/down last commands, but extended as it persists beyond the current instance of your powershell as it reads from the history
Copy code
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
I also have
Import-Module npm-completion
for autocomplete on npm commands
s

Sebastiaan

03/04/2022, 11:49 AM
Excellent I'll have a play with those as well!
Ah I see, so
dotnet
and then
CTRL+SPACE
gives hints.. cool!
npm completion is also nice!
w

warrenbuckley

03/07/2022, 10:12 AM
@User care to share your JSON config of ohmyposh ?
s

Sebastiaan

03/07/2022, 10:19 AM
Sure thing!
w

warrenbuckley

03/07/2022, 11:05 AM
Thanks a nice couple of bits you got in here for execution time etc
s

Sebastiaan

03/07/2022, 11:27 AM
Oh yeah totally stolen from another theme of course!