376 字
2 分钟
Set up Windows Subsystem for Linux
最终效果 Windows, 最好的 Linux 发行版
WSL set up
- 开启 WSL
# PowerShellEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux- 到 MicroSoft Store 找一个发行版安装
- wsl 初始化
apt update && apt upgrade -yapt install -y git vim build-essential screenfetchapt install -y curl netcatZsh
- 安装
# install zshsudo apt-get install zsh# install oh-my-zshsh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"- 将 zsh 设为默认 shell
chsh -s $(which zsh)
bash -c zsh
# ~/.zshrc# customizecd ~screenfetch- 修改 zsh 主题,因为 agnoster 主题在 hyper 上有点问题,所以我使用了风格接近的 bullet-train
- 更多主题可以查看这里 themes
ZSH_THEME="bullet-train"-
安装 zsh 插件
-
highlighting 和 autosuggestions 几乎是必装插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightinggit clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestionsplugins=( # z git zsh-syntax-highlighting zsh-autosuggestions)# fix wsl z# @see https://github.com/rupa/z/issues/230case $(uname -a) in *Microsoft*) unsetopt BG_NICE ;;esacInstall Powerline Fonts on Windows 10
- 这一步主要是解决终端符号显示不全的问题
- 下载 powerline/fonts
- 使用管理员权限运行
install.ps1 - 修改终端字体为带有 Powerline 的字体
Hyper set up
fontSize: 12,fontSize: 14, // 调整字体大小
copyOnSelect: falsecopyOnSelect: true // 选择即复制
shell: '',shell: 'C:\\Windows\\System32\\wsl.exe', // 默认启动 wsl
shellArgs: ['--login'],shellArgs: [],
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',fontFamily: '"DejaVu Sans Mono for Powerline"', // 调整字体为 Pownline 的字体
plugins: [],plugins: ['hyper-material-theme'], // 主题插件integrate vscode
- 修改设置使 vscode 使用 wsl,同时修改字体为 Powerline 字体
{ "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe", "terminal.integrated.fontFamily": "Source Code Pro for Powerline"}Reference
Set up Windows Subsystem for Linux
https://www.waterwater.moe/posts/2019/2019-06-24_wsl/