前言
最近在喵神 onevcat 的直播中发现喵神直接在终端就能用 vsCode 打开当前代码目录,非常方便。
在zsh
终端中 使用 code .
,在 vcCode 打开当前文件目录
正文
配置终端环境
zsh 使用 oh_my_zsh 配置
安装zsh
查看你的系统有几种shell
cat /etc/shells
显示
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
安装 oh my zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
重新打开终端,输入
zsh
即可切换终端,并且发现 oh my zsh 已经帮我们配置好 zsh 了
修改主题
open ~/.zshrc
修改 ZSH_THEME=”robbyrussell”
,主题在 ~/.oh-my-zsh/themes 目录下。
修改为
ZSH_THEME="kolo"
可以参照这里进行选择.
设置为默认shell
chsh -s /bin/zsh
修改 zsh
配置文件
$ open ~/.zshrc
在文件中加上这几行代码
对应 atom、SublimeText、与 vcCode。
alias atom='/Applications/Atom.app/Contents/MacOS/Atom'
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
alias code='/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code'
测试
使用 vcCode 打开
$ code .
- 原文作者:玄离
- 原文链接:http://www.yzqlwt.com/posts/2017-03-17-Mac%E7%BB%88%E7%AB%AFzsh%E4%B8%8B%E7%94%A8%E4%BB%A3%E7%A0%81%E7%BC%96%E8%BE%91%E5%99%A8%E6%89%93%E5%BC%80%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。