# vscode windows下使用 on-my-zsh

1.下载使用  [Cygwin](https://cygwin.com/install.html) <br>
2.安装步骤如图所示<br>

![Snipaste_2021-05-12_13-02-40.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620795918550/i3X-sIYfM.png)


![Snipaste_2021-05-12_13-03-05.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620795926231/T1tatTS7n.png)

![Snipaste_2021-05-12_13-03-13.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620795932281/9fkbCw0Dm.png)

![Snipaste_2021-05-12_13-03-30.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620795939090/XPl5t9upw.png)
👆此处可选择国内源  [网易源](https://mirrors.163.com/.help/cygwin.html) 

![Snipaste_2021-05-12_13-04-15.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620795945692/EsFoyutrT.png)

3.完成安装并启动终端。<br>
4.我们将使用Cygwin安装一些软件包，这些软件包将有助于在Windows上使用Linux系统。我们将安装apt-cyg，它将像apt-get一样工作，并且还将安装许多其他软件包，例如vim。

```
     > wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg

     > install apt-cyg /bin

     > apt-cyg install curl zsh git gdb dos2unix openssh vim [or your favorite text editor]
``` 
5.此时我们安装完相关依赖。 <br>
6.现在开始我们配置增加 on-my-zsh。<br>

```
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
``` 
7.默认情况下系统并没有选择 `zsh` 配置，需要到用户目录中配置 `.bashrc` <br>

```
      > cd ~
      > vim .bashrc
``` 
8.在配置项最后增加 `exec /bin/zsh` 保存并执行 `source .bashrc` 这样每次打开 `Cygwin` 都会默认开启zsh。<br>
9.修改文件`.zshrc` 修改自己喜欢的主题 我使用的是 `Obraun`   。 [点击查看皮肤列表](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) 。<br>

```shell
     > cd ~
     > vim .zshrc
     > 找到文件的中的 ZSH_THEME="Obraun"  Obraun是我的主题，可修改自己喜欢的 ~
``` 
10.保存并 执行 `source .zshrc`。<br>
11.设置 `vscode` 中的终端为 `Cygwin` 步骤如下 👇<br>

![Snipaste_2021-05-12_13-29-01.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620797583756/oBF48PZsI.png)
![Snipaste_2021-05-12_13-30-49.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620797593063/qGKc3Nqoo.png)
![Snipaste_2021-05-12_13-31-58.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1620797604324/x_Akc4oGL.png)
12.`vscode`相关配置

```jsonc
  "terminal.integrated.defaultProfile.windows": "Cygwin",
  "terminal.integrated.profiles.windows": {
    "Cygwin": {
       // 此处发现一个bug，长时间未使用终端会导致无法输入
      // "path": "C:\\cygwin64\\bin\\bash.exe"，
      // 使用zsh就好了
      "path": "C:\\cygwin64\\bin\\zsh.exe"
    }
  }
``` 
完成，又可以开心的coding了 ~~~~


