打造Mac下最好用的终端工具
安装brew
Mac下首先需要安装brew,包管理工具。安装方式:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装iTerm2
不多说,之前使用iTerm2,为了颜值,中间转向了Hyper,后来发现其搜索的大坑,算了还是iTerm2靠谱。
brew cask install iterm
安装oh-my-zsh
系统默认使用bash,而使用oh-my-zsh是一种生活态度。
# 安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
安装oh-my-zsh插件
这是oh-my-zsh最爽的地方,内置插件列表:https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins
选取了几个自定义必备插件:
- pure-prompt:优化显示
- zsh-autocomplete:自动补全插件
- zsh-autosuggestions:自动建议插件
- autojump:记录跳转路径插件
# 安装美化插件
npm install --global pure-prompt
brew install zsh-syntax-highlighting
brew install autojump
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete
# 修改配置,增加以下内容
vi ~/.zshrc
~~~
plugins=(
git
brew
node
npm
autojump
zsh-autosuggestions
)
autoload -U promptinit; promptinit
prompt pure
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh
~~~
# 修改默认shell
chsh -s $(which zsh)
配置vim语法高亮、行号等
# 复制一份模板
cp /usr/share/vim/vimrc ~/.vimrc
vi ~/.vimrc
> syntax on
> set nu!
其他选项见下:
set nocompatible "去掉有关vi一致性模式,避免以前版本的bug和局限
set nu! "显示行号
set guifont=Luxi/ Mono/ 9 " 设置字体,字体名称和字号
filetype on "检测文件的类型
set history=1000 "记录历史的行数
set background=dark "背景使用黑色
syntax on "语法高亮度显示
set autoindent "vim使用自动对齐,也就是把当前行的对齐格式应用到下一行(自动缩进)
set cindent "(cindent是特别针对 C语言语法自动缩进)
set smartindent "依据上面的对齐格式,智能的选择对齐方式,对于类似C语言编写上有用
set tabstop=4 "设置tab键为4个空格,
set shiftwidth =4 "设置当行之间交错时使用4个空格
set ai! " 设置自动缩进
set showmatch "设置匹配模式,类似当输入一个左括号时会匹配相应的右括号
set guioptions-=T "去除vim的GUI版本中得toolbar
set vb t_vb= "当vim进行编辑时,如果命令错误,会发出警报,该设置去掉警报
set ruler "在编辑过程中,在右下角显示光标位置的状态行
set nohls "默认情况下,寻找匹配是高亮度显示,该设置关闭高亮显示
set incsearch "在程序中查询一单词,自动匹配单词的位置;如查询desk单词,当输到/d时,会自动找到第一个d开头的单词,当输入到/de时,会自动找到第一个以ds开头的单词,以此类推,进行查找;当找到要匹配的单词时,别忘记回车
set backspace=2 " 设置退格键可用
使用ssh config editor工具
不用多介绍了,自行google,.ssh/config
的图形化编辑工具。