Skip to content

Instantly share code, notes, and snippets.

@mashirozx
Created September 6, 2021 06:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
PowerShell Profile
Import-Module posh-git
Import-Module oh-my-posh
# Set-PoshPrompt -Theme Aliens
Set-PoshPrompt -Theme jandedobbeleer
Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录
Set-PSReadlineKeyHandler -Key Tab -Function Complete # 设置 Tab 键补全
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录
Function CD01 {
git diff --name-only --diff-filter=U
}
Set-Alias -Name gdiff -Value CD01
Function CD02([string]$Step)
{
git rebase -i HEAD~$Step
}
Set-Alias -Name rebase -Value CD02
Function CD03([string]$pattern, [string]$path)
{
Get-ChildItem -path $path -Recurse | Select-String -Pattern "$pattern" -CaseSensitive
}
Set-Alias -Name grep -Value CD03
# alias rebasep='git pull --rebase upstream main'
# alias rebasec='git rebase --continue'
# alias rebase='RUN() { git rebase -i HEAD~$1; }; RUN'
# alias gdiff='git diff --name-only --diff-filter=U'
# alias gdrop='git branch | grep -v "master" | xargs git branch -D '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment