init
This commit is contained in:
commit
24fc4e3d67
36
Microsoft.PowerShell_profile.ps1
Normal file
36
Microsoft.PowerShell_profile.ps1
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# 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 }
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# My Profile of PowerShell on Windows / 我的 PowerShell 配置文件
|
||||||
|
|
||||||
|
## Description / 描述
|
||||||
|
|
||||||
|
This profile is simple but more productive when work in terminals. I just create a proxy switcher and some command alias.
|
||||||
|
这个配置文件简单,但是终端操作时会让你很有精神。我目前只作了代理切换和一些命令行缩略别名。
|
||||||
|
|
||||||
|
## Configure / 配置
|
||||||
|
|
||||||
|
### PreInstalled (Strongly Needed) / 预装的命令行程式 (必须的)
|
||||||
|
|
||||||
|
- `Starship` A Prompt for any shell. 支持各种 Shell 的终端提示优化 <https://github.com/starship/starship>
|
||||||
|
- `Zoxide` A smarter cd command. 更智能的 cd 命令 <https://github.com/ajeetdsouza/zoxide>
|
||||||
|
|
||||||
|
### Load the Profile / 载入配置
|
||||||
|
|
||||||
|
Two Ways for the profile, each one is ok! / 配置有两种方式,任意一种都可以。
|
||||||
|
|
||||||
|
1. Just copy the [Microsoft.PowerShell_profile.ps1](./Microsoft.PowerShell_profile.ps1) file content info Powershell Profile Directory! 只需要将[配置文件内容](./Microsoft.PowerShell_profile.ps1)拷贝到 Powershell 的 profile 文件夹里。
|
||||||
|
|
||||||
|
2. Git clone into Windows Document Directory if not exist profile dir. 如果没有配置文件夹,克隆这个仓库到系统的文档路径下
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
cd ([System.Environment]::GetFolderPath('MyDocuments'))
|
||||||
|
git clone --depth 1 https://git.unvec.site/stevenhobs/pwsh-profile.git Powershell # Powershell 7
|
||||||
|
git clone --depth 1 https://git.unvec.site/stevenhobs/pwsh-profile.git WindowsPowershell # if you use old powershell
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user