-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_pwsh_packages.ps1
executable file
·43 lines (37 loc) · 1.56 KB
/
install_pwsh_packages.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
#!/opt/microsoft/powershell/pwsh
Install-Module -Name PSReadLine -Scope CurrentUser -Force
Install-Module -Name Terminal-Icons -Scope CurrentUser -Force
Install-Module -Name z -Scope CurrentUser -Force
Install-Module -Name posh-git -Scope CurrentUser -Force
Install-Module -Name PSfzf -Scope CurrentUser -Force
Install-Module -Name QueryExcel -Scope CurrentUser -Force
$profile_text = @'
oh-my-posh init pwsh --config "~/dracula.omp.json" | Invoke-Expression
Function Edit-Profile { nano $PROFILE.CurrentUserAllHosts }
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "~/miniforge3/bin/conda") {
(& "~/miniforge3/bin/conda" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
}
#endregion
if ($host.Name -eq 'ConsoleHost') {
Import-Module PSReadLine
Import-Module Terminal-Icons
Import-Module z
Import-Module posh-git
Import-Module PSFzf
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PsFzfOption -PSReadlineChordReverseHistory 'Ctrl+r'
}
function Set-PoshGitStatus {
$global:GitStatus = Get-GitStatus
$env:POSH_GIT_STRING = Write-GitStatus -Status $global:GitStatus
}
New-Alias -Name 'Set-PoshContext' -Value 'Set-PoshGitStatus' -Scope Global -Force
$GitPromptSettings.BranchColor.ForegroundColor = '#f8f8f2'
$GitPromptSettings.BeforeStatus = ""
$GitPromptSettings.AfterStatus = ""
'@
Add-Content -Path $Profile.CurrentUserAllHosts -Value $profile_text
Write-Host 'install_pwsh_packages.ps1 is done' -ForegroundColor Green