Skip to content

Commit

Permalink
Enable PowerShell profile and commenting hotkey for PowerShell ISE
Browse files Browse the repository at this point in the history
  • Loading branch information
AgenttiX committed Nov 2, 2024
1 parent 701d60a commit 705dc16
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Profile/Microsoft.PowerShellISE_profile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function Toggle-Comment {
<#
.LINK
https://superuser.com/a/1730675
#>
$file = $psise.CurrentFile
$text = $file.Editor.SelectedText
if ($text.StartsWith("<#")) {
$comment = $text.Substring(2).TrimEnd("#>")
}
else
{
$comment = "<#" + $text + "#>"
}
$file.Editor.InsertText($comment)
}

# https://superuser.com/a/1730675
$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Toggle Comment', { Toggle-Comment }, 'CTRL+K') | Out-Null
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file gets loaded by both PowerShell and PowerShell ISE

function Enable-SSHAgent {
. "${env:ProgramFiles}\Git\cmd\start-ssh-agent.cmd"
}
Expand All @@ -9,5 +11,5 @@ function Enable-SSHAgent {
# See https://ch0.co/tab-completion for details.
$ChocolateyProfile = "${env:ChocolateyInstall}\helpers\chocolateyProfile.psm1"
if (Test-Path("${ChocolateyProfile}")) {
Import-Module "${ChocolateyProfile}"
Import-Module "${ChocolateyProfile}"
}

0 comments on commit 705dc16

Please sign in to comment.