Skip to content

Instantly share code, notes, and snippets.

@syfxlin
Last active June 5, 2021 15:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syfxlin/3930bcf79465f0bde4b68cea6e2dfab0 to your computer and use it in GitHub Desktop.
Save syfxlin/3930bcf79465f0bde4b68cea6e2dfab0 to your computer and use it in GitHub Desktop.
我的 PowerShell Profile 配置文件
Invoke-Expression (oh-my-posh --init --shell pwsh --config "$(scoop prefix oh-my-posh3)/themes/ys.omp.json")
Import-Module $env:USERPROFILE\scoop\modules\scoop-completion
Remove-Item alias:\curl
Remove-Item alias:\wget
Remove-Item alias:\rm
Remove-Item alias:\ls
Remove-Item alias:\cp
Set-Alias proxy "D:\Documents\WindowsPowerShell\proxy.ps1"
Set-Alias apt scoop
Set-Alias wgt winget
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineKeyHandler -Key Ctrl+q -Function TabCompleteNext
Set-PSReadLineKeyHandler -Key Ctrl+Q -Function TabCompletePrevious
Set-PSReadLineKeyHandler -Key Ctrl+C -Function Copy
Set-PSReadLineKeyHandler -Key Ctrl+v -Function Paste
Set-PSReadLineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen
Set-PSReadLineKeyHandler -Key Alt+d -Function ShellKillWord
Set-PSReadLineKeyHandler -Key Alt+Backspace -Function ShellBackwardKillWord
Set-PSReadLineKeyHandler -Key Alt+b -Function ShellBackwardWord
Set-PSReadLineKeyHandler -Key Alt+f -Function ShellForwardWord
Set-PSReadLineKeyHandler -Key Alt+B -Function SelectShellBackwardWord
Set-PSReadLineKeyHandler -Key Alt+F -Function SelectShellForwardWord
function encode($args) {
$e = $args[0];
$encode = [System.Text.Encoding]::Default;
if ($e -eq "default") {
$encode = [System.Text.Encoding]::Default;
} else {
$encode = [System.Text.Encoding]::GetEncoding($e);
}
[Console]::OutputEncoding = $encode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment