powershell_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
powershell_configuration [2021/10/22 22:16] mguptonpowershell_configuration [2022/04/08 12:54] (current) mgupton
Line 12: Line 12:
  
 To edit Powershell profile To edit Powershell profile
-<code>+<code powershell>
 notepad $PROFILE notepad $PROFILE
 </code> </code>
  
-=== Example: baseline config ===+Dot (.) source to reload $PROFILE into current sessions, just like Bash 
 +<code powerhell> 
 +. $profile 
 +</code> 
 + 
 +Get path to command history file 
 +<code powershell> 
 +(Get-PSReadlineOption).HistorySavePath 
 +</code> 
 + 
 +=== Reference Config ===
  
-<code>+<code powershell>
 $env:Path += ";c:\od\scripts" $env:Path += ";c:\od\scripts"
 $od = "$home\OneDrive" $od = "$home\OneDrive"
Line 25: Line 35:
 Set-PoshPrompt -Theme mg Set-PoshPrompt -Theme mg
    
 +$host.PrivateData.ErrorForegroundColor = 'Cyan'
 +$host.PrivateData.ErrorBackgroundColor = 'Black'
 +
 set-alias exp explorer.exe set-alias exp explorer.exe
 +set-alias gs git-save
 +set-alias gd git-dump
 +set-alias mgi c:\od\scripts\git-init.ps1
 +set-alias npp notepad++.exe
    
 Set-PSReadLineOption -HistoryNoDuplicates Set-PSReadLineOption -HistoryNoDuplicates
- + 
 +function npw() { 
 +    param( 
 +        [Parameter(Position=0)] 
 +        $folder 
 +    ) 
 +    Start-Process notepad++.exe -ArgumentList "-openFoldersAsWorkspace $folder" 
 +
 function h2 { function h2 {
     notepad (Get-PSReadLineOption | select -ExpandProperty HistorySavePath)         notepad (Get-PSReadLineOption | select -ExpandProperty HistorySavePath)    
Line 45: Line 70:
     }     }
 } }
- + 
 +function hpp { 
 + Start-Process notepad++.exe (Get-PSReadlineOption).HistorySavePath 
 +}  
 function git-dump([Parameter(Mandatory=$true)][string]$commit, [Parameter(Mandatory=$true)][string]$path) { function git-dump([Parameter(Mandatory=$true)][string]$commit, [Parameter(Mandatory=$true)][string]$path) {
     $temp_file="c:\tmp\git-dump.zip"; git archive -o $temp_file $commit; Expand-Archive -path $temp_file -destinationpath $path     $temp_file="c:\tmp\git-dump.zip"; git archive -o $temp_file $commit; Expand-Archive -path $temp_file -destinationpath $path
  • powershell_configuration.1634941007.txt.gz
  • Last modified: 2021/10/22 22:16
  • by mgupton