File tree Expand file tree Collapse file tree 1 file changed +90
-0
lines changed Expand file tree Collapse file tree 1 file changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : post
3
+ title : Mac终端(zsh)用sublime、vscode、atom打开文件或目录
4
+ subtitle : 更改 zsh 配置文件,在终端使用代码编辑器快速打开文件或目录
5
+ date : 2017-03-17
6
+ author : BY
7
+ header-img : img/post-bg-debug.png
8
+ catalog : true
9
+ tags :
10
+ - Mac
11
+ - 效率
12
+ - 终端
13
+ - zsh
14
+ ---
15
+
16
+ # 前言
17
+
18
+ 最近在喵神 onevcat 的直播中发现喵神直接在终端就能用 vsCode 打开当前代码目录,非常方便。
19
+
20
+ 在` zsh ` 终端中 使用 ` code . ` ,在 ** vcCode** 打开当前文件目录
21
+
22
+ ![ ] ( https://ww2.sinaimg.cn/large/006tKfTcgy1fdpxob9m7sj31000rkam7.jpg )
23
+
24
+
25
+ # 正文
26
+
27
+ ## 配置终端环境
28
+
29
+ 终端环境为:[ iTerm2] ( https://www.iterm2.com/ ) + [ zsh] ( https://wiki.archlinux.org/index.php/Zsh_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) )
30
+
31
+ zsh 使用 [ oh_my_zsh] ( http://ohmyz.sh/ ) 配置
32
+
33
+
34
+ ## 安装zsh
35
+
36
+ #### 查看你的系统有几种shell
37
+
38
+ cat /etc/shells
39
+
40
+ 显示
41
+
42
+ /bin/bash
43
+ /bin/csh
44
+ /bin/ksh
45
+ /bin/sh
46
+ /bin/tcsh
47
+ /bin/zsh
48
+ #### 安装 oh my zsh
49
+
50
+ git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
51
+ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
52
+
53
+ 重新打开终端,输入
54
+
55
+ zsh
56
+
57
+ 即可切换终端,并且发现 oh my zsh 已经帮我们配置好 zsh 了
58
+
59
+ #### 修改主题
60
+
61
+ open ~/.zshrc
62
+
63
+ 修改 ` ZSH_THEME=”robbyrussell” ` ,主题在 ~ /.oh-my-zsh/themes 目录下。
64
+ 修改为
65
+
66
+ ZSH_THEME="kolo"
67
+
68
+ 可以[ 参照这里] ( https://github.com/robbyrussell/oh-my-zsh/wiki/themes ) 进行选择.
69
+
70
+ #### 设置为默认shell
71
+
72
+ chsh -s /bin/zsh
73
+
74
+ ## 修改 ` zsh ` 配置文件
75
+
76
+ $ open ~/.zshrc
77
+
78
+ 在文件中加上这几行代码
79
+
80
+ 对应 atom、SublimeText、与 vcCode。
81
+
82
+ alias atom='/Applications/Atom.app/Contents/MacOS/Atom'
83
+ alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
84
+ alias code='/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code'
85
+
86
+ #### 测试
87
+ 使用 vcCode 打开
88
+
89
+ $ code .
90
+
You can’t perform that action at this time.
0 commit comments