Windows Powershell 美化

原始链接 https://zhuanlan.zhihu.com/p/137595941 安装 Windows Terminal MicroSoft 应用商店 安装字体 Fira Code Nerd Font https://github.com/ryanoasis/nerd-fonts/releases 安装新的 PowerShell https://github.com/PowerShell/PowerShell/releases/tag/v7.2.1 安装 PowerShell 插件 # 1. 安装 PSReadline 包,该插件可以让命令行很好用,类似 zsh Install-Module -Name PSReadLine -Scope CurrentUser # 2. 安装 posh-git 包,让你的 git 更好用 Install-Module posh-git -Scope CurrentUser # 3. 安装 oh-my-posh 包,让你的命令行更酷炫、优雅 Install-Module oh-my-posh -Scope CurrentUser 添加 Powershell 启动参数 输入命令 notepad.exe $Profile 在文本框装填入以下内容 #------------------------------- Import Modules BEGIN ------------------------------- # 引入 posh-git Import-Module posh-git # 引入 oh-my-posh Import-Module oh-my-posh # 引入 ps-read-line Import-Module PSReadLine # 设置 PowerShell 主题 # Set-PoshPrompt ys Set-PoshPrompt paradox #------------------------------- Import Modules END ------------------------------- #------------------------------- Set Hot-keys BEGIN ------------------------------- # 设置预测文本来源为历史记录 Set-PSReadLineOption -PredictionSource History # 每次回溯输入历史,光标定位于输入内容末尾 Set-PSReadLineOption -HistorySearchCursorMovesToEnd # 设置 Tab 为菜单补全和 Intellisense Set-PSReadLineKeyHandler -Key "Tab" -Function MenuComplete # 设置 Ctrl+d 为退出 PowerShell Set-PSReadlineKeyHandler -Key "Ctrl+d" -Function ViExit # 设置 Ctrl+z 为撤销 Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置向上键为后向搜索历史记录 Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向下键为前向搜索历史纪录 Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward #------------------------------- Set Hot-keys END -------------------------------

2022-02-09 · 1 分钟 · 153 字

zsh,oh-my-zsh安装

# 安装zsh sudo apt-get install zsh # 将zsh切换成默认shell chsh -s /bin/zsh # 安装 oh-my-zsh sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # Add powerlevel10k to the list of Oh My Zsh themes. git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k # Replace ZSH_THEME="powerlevel9k/powerlevel9k" with ZSH_THEME="powerlevel10k/powerlevel10k". sed -i.bak 's/powerlevel9k/powerlevel10k/g' ~/.zshrc # 安装插件 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting vim ~/.zshrc # 修改文件内容 plugins=(git zsh-autosuggestions zsh-syntax-highlighting) # 保存,执行文件 source ~/.zshrc

2021-04-24 · 1 分钟 · 65 字