-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMicrosoft.PowerShell_profile.ps1
65 lines (56 loc) · 1.62 KB
/
Microsoft.PowerShell_profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$BashAliasPwsh = "$PSScriptRoot/bash_alias.ps1"
$Bash2Pwsh = "$PSScriptRoot/bash2pwsh.js"
$BashAlias = "$PSScriptRoot/.alias.zsh"
function bash2pwsh_alias() {
echo "node $Bash2Pwsh $BashAlias $BashAliasPwsh"
node $Bash2Pwsh $BashAlias $BashAliasPwsh
}
$PWSHProfile = $PSCommandPath
# if you want to use bash like command in powershell,
# it is recommended to install gow.
# "scoop install gow"
function edit_pwsh_profile {
echo "code $PWSHProfile"
code $PWSH_Profile
}
# https://stackoverflow.com/a/69135912/5570400
#
# Pipe output to vscode
#
# Usage :
# ls | oc
Function Out-Code {
do {
$filename = New-Guid
$filename = $filename.toString() + ".md"
} while (Test-Path $filename)
$input > $filename
code $filename
Start-Sleep 1
Remove-Item $filename
}
Set-Alias oc Out-Code
# reload profile script
function re {
echo ". $PWSHProfile"
. $PWSHProfile
}
# https://stackoverflow.com/a/47075453/14820021
.$BashAliasPwsh
echo "PS Profile [Editable] :"
echo " $PSCommandPath"
echo "Bash Alias [Editable] :"
echo " $BashAlias"
echo "Bash2Pwsh / Conversion Script [Editable]"
echo " $Bash2Pwsh"
echo "PW Bash Alias (is Read from PS Profile) [Auto Generated] :"
echo " $BashAliasPwsh"
echo ""
echo "If you want to edit both PowerShell and Bash aliases at the same time :"
echo " 1. Edit Bash Alias ('$BashAlias')"
echo " 2. Type 'bash2pwsh_alias' in PowerShell (convert Bash Alias to Powershell Profile)"
echo " 3. Type 're' in PowerShell (reload profile)"
# https://github.com/dahlbyk/posh-git
Import-Module posh-git
# https://github.com/joonro/Get-ChildItemColor
Import-Module Get-ChildItemColor