赶知识网

Mac Shell终端美化及Vim语法高亮

2021-01-14 / 1987次点击 OS/操作系统 Mac Shell Vim

Shell终端美化
待追加到 ~/.bash_profile 的内容


export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
export PS1='\[\e[01;33m\][\[\e[01;32m\]\u\[\e[01;33m\]@\[\e[01;35m\]\h:\[\e[01;33m\]] \[\e[01;36m\]\w \[\e[01;32m\]\$ '

vim ~/.bash_profile  # 将上述内容追加至该文件中

. ~/.bash_profile

 

遇到问题:.bash_profile换了终端不生效


mac终端类型有两种,zsh和bash,
其中,bash初始化默认.bash_profile
zsh初始化默认.zshrc


我的Catalina系统默认zsh终端,所以.bash_profile并不会初始化。
切换一下即可:


chsh -s /bin/bash

切换回zsh : chsh -s /bin/zsh

Vim语法高亮

cp /usr/share/vim/vimrc ~/.vimrc
vim ~/.vimrc  # 将上述内容追加至该文件中


syntax on
set nu!
set cindent
set background=dark
set ruler


有用 0 没用 0

Top10

沪ICP备09053415号 © 赶知识网