浅浅美化一下WSL

Posted by Kody Black on December 6, 2022

neofetch

先用neofetch, 先试一下自己的系统配置吧~

用处不大

Shell解释器

cat /etc/shells可以看到自己有哪些shell

~$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
/usr/bin/tmux
/usr/bin/screen

Ubuntu默认解释器是Bash(Bourne Again shell

env查看环境变量可以看到SHELL=/bin/bash

常见的解释器包括:

  • sh
  • bash
  • dash
  • ksh
  • zsh

主要区别还是在于大小和功能特性上面,在本地wsl上面,自然是zsh这种好看的东西比较适合我

zsh

sudo apt-get install zsh

chsh -s /bin/zsh # 把zsh设置为默认shell

oh-my-zsh

安装

sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

貌似需要在当前用户和root用户下各安装一个,这样才会在两种情况下都有效

选择主题

vim .zshrc # 修改配置文件

然后修改ZSH_THEME="robbyrussell"即可,主题见https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

个人推荐安装使用powerlevel10k

插件

添加了两个插件,zsh-autosuggestions和zsh-syntax-highlighting(自动提示和语法高亮)

插件下载:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

还是修改.zshrc

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
        git
        zsh-autosuggestions
        zsh-syntax-highlighting
)

好啦好啦,满意了,继续干活了