Microsoft.PowerShell_profile.ps1
· 2.0 KiB · PowerShell
原始文件
Set-Alias -Name ll -Value ls
Set-Alias -Name pn -Value pnpm
function open {
param ($path)
if ($path) {
explorer.exe $path
} else {
Write-Output "Please input a path."
}
}
function vvv {
open D:\Programs\v2rayN\v2rayN.exe
}
function 1remote {
open D:\Programs\1Remote\1Remote.exe
}
function proxyset {
param ($url)
$defUrl = "http://127.0.0.1:1080"
if ($url) {
$defUrl = $url
}
$env:http_proxy=$defUrl
$env:https_proxy=$defUrl
Write-Output "proxy is set to: $defUrl"
}
function proxyclear {
$env:http_proxy=""
$env:https_proxy=""
}
function gitproxyset {
param ($url)
$defUrl = "http://127.0.0.1:1080"
if ($url) {
$defUrl = $url
}
git config --global http.proxy $defUrl
git config --global https.proxy $defUrl
Write-Output "git proxy is set to:"
git config list --global | findstr proxy
}
function gitproxyclear {
git config --global --unset http.proxy
git config --global --unset https.proxy
Write-Output "git proxy is unset"
git config list --global | findstr proxy
}
function proxyprint {
Write-Output "http_proxy: $env:http_proxy"
Write-Output "https_proxy: $env:https_proxy"
}
function GotoGitrepository {
Set-Location D:\GitRepository
}
function GotoDesktop {
Set-Location C:\Users\Administrator\Desktop
}
# oh-my-posh init pwsh | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/quick-term.omp.json" | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/takuya.omp.json" | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/hunk.omp.json" | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_rainbow.omp.json" | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/star.omp.json" | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess.omp.json" | Invoke-Expression
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess_Re.omp.json" | Invoke-Expression
| 1 | Set-Alias -Name ll -Value ls |
| 2 | Set-Alias -Name pn -Value pnpm |
| 3 | |
| 4 | function open { |
| 5 | param ($path) |
| 6 | if ($path) { |
| 7 | explorer.exe $path |
| 8 | } else { |
| 9 | Write-Output "Please input a path." |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | function vvv { |
| 14 | open D:\Programs\v2rayN\v2rayN.exe |
| 15 | } |
| 16 | |
| 17 | function 1remote { |
| 18 | open D:\Programs\1Remote\1Remote.exe |
| 19 | } |
| 20 | |
| 21 | function proxyset { |
| 22 | param ($url) |
| 23 | |
| 24 | $defUrl = "http://127.0.0.1:1080" |
| 25 | if ($url) { |
| 26 | $defUrl = $url |
| 27 | } |
| 28 | $env:http_proxy=$defUrl |
| 29 | $env:https_proxy=$defUrl |
| 30 | Write-Output "proxy is set to: $defUrl" |
| 31 | } |
| 32 | |
| 33 | function proxyclear { |
| 34 | $env:http_proxy="" |
| 35 | $env:https_proxy="" |
| 36 | } |
| 37 | |
| 38 | function gitproxyset { |
| 39 | param ($url) |
| 40 | |
| 41 | $defUrl = "http://127.0.0.1:1080" |
| 42 | if ($url) { |
| 43 | $defUrl = $url |
| 44 | } |
| 45 | git config --global http.proxy $defUrl |
| 46 | git config --global https.proxy $defUrl |
| 47 | Write-Output "git proxy is set to:" |
| 48 | git config list --global | findstr proxy |
| 49 | } |
| 50 | |
| 51 | function gitproxyclear { |
| 52 | git config --global --unset http.proxy |
| 53 | git config --global --unset https.proxy |
| 54 | Write-Output "git proxy is unset" |
| 55 | git config list --global | findstr proxy |
| 56 | } |
| 57 | |
| 58 | function proxyprint { |
| 59 | Write-Output "http_proxy: $env:http_proxy" |
| 60 | Write-Output "https_proxy: $env:https_proxy" |
| 61 | } |
| 62 | |
| 63 | function GotoGitrepository { |
| 64 | Set-Location D:\GitRepository |
| 65 | } |
| 66 | |
| 67 | function GotoDesktop { |
| 68 | Set-Location C:\Users\Administrator\Desktop |
| 69 | } |
| 70 | |
| 71 | # oh-my-posh init pwsh | Invoke-Expression |
| 72 | # oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/quick-term.omp.json" | Invoke-Expression |
| 73 | # oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/takuya.omp.json" | Invoke-Expression |
| 74 | # oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/hunk.omp.json" | Invoke-Expression |
| 75 | # oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_rainbow.omp.json" | Invoke-Expression |
| 76 | # oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/star.omp.json" | Invoke-Expression |
| 77 | # oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess.omp.json" | Invoke-Expression |
| 78 | oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess_Re.omp.json" | Invoke-Expression |