37 lines
1.2 KiB
PowerShell
37 lines
1.2 KiB
PowerShell
# Prompt增强
|
|
Invoke-Expression (&starship.exe init powershell)
|
|
Invoke-Expression (& { (zoxide.exe init powershell | Out-String) })
|
|
|
|
# 网络代理切换
|
|
function Set-Proxy {
|
|
param (
|
|
[string]$HostIp = "127.0.0.1",
|
|
[int]$Port = 7890 # 更改为你
|
|
)
|
|
$env:http_proxy = "http://${HostIp}:$Port"
|
|
$env:https_proxy = "http://${HostIp}:$Port"
|
|
$env:no_proxy = "localhost,127.0.0.1"
|
|
Write-Host "--[ Set Network Proxy! Value: HostIp = $HostIp , Port = $Port ]--"
|
|
}
|
|
function Remove-Proxy {
|
|
Remove-Item Env:http_proxy -ErrorAction SilentlyContinue
|
|
Remove-Item Env:https_proxy -ErrorAction SilentlyContinue
|
|
Remove-Item Env:no_proxy -ErrorAction SilentlyContinue
|
|
Write-Host "--[ Remove Network Proxy! ]--"
|
|
}
|
|
|
|
# 命令别名-系统
|
|
Set-Alias open explorer.exe
|
|
Set-Alias which where.exe
|
|
Set-Alias edit notepad.exe
|
|
Set-Alias new ni
|
|
Set-Alias touch ni
|
|
Set-Alias grep findstr
|
|
# 命令别名-应用
|
|
Remove-Alias cd -Scope Local #This for zoxide
|
|
Set-Alias cd __zoxide_z
|
|
Set-Alias s sudo
|
|
|
|
# 系统路径或特定文件夹自动切换到~
|
|
if ( (Get-Location).Path -match "\\Windows\\System32|MyDockFinder" ) { Set-Location $HOME }
|