powershell-profile icon indicating copy to clipboard operation
powershell-profile copied to clipboard

FEATURE: Edit-Profile function

Open pa-0 opened this issue 2 months ago • 0 comments

This is more just a UX suggestion for everyone using your $PROFILE script. I have already implemented this in my own 'dotfiles' so just thought I'd share because I think it's pretty convenient:

For anyone who uses a Profile.ps1 for their own custom settings (in addition to syncing with the $PROFILE you offer on this repo), this helps preventing me from mistakenly adding any customizations to the 'main' $PROFILE script (since any of those changes will ultimately get overwritten when it syncs up with GitHub. It's also handy in that any changes I make are also synced to GitHub allowing me to use it on different machines.

In my fork to your repo, I've added this function:

function Edit-Profile { 
    start microsoft-edge:https://github.com/USERNAME/REPO/edit/main/Profile.ps1 
}
Set-Alias -Name ep -Value Edit-Profile

Note "edit" in the URL path. Typing "ep" or Edit-Profile in PowerShell automatically opens an editable version of Profile.ps1 in the browser.

I've added a line to your Update-Profile function so that it runs a check against the Profile.ps1 linked in the Edit-Profile function above so it syncs my custom file in addition to your main $PROFILE script.

I can make my changes there, knowing that it will sync across all my devices and avoiding potentially making those changes in the wrong script, e.g., the file opened when running the command code $PROFILE.

pa-0 avatar Jun 25 '24 01:06 pa-0