当前位置: 首页 > 工具软件 > Terminal.Gui > 使用案例 >

Terminal 终端常用配置

都阳辉
2023-12-01

iTerm2 基础配置

  1. 下载字体 Fira Code
  2. 在 Profile -> Colors 里,我们把 Background 改成 #252B3A ,把 ANSI Color 中的 Blue 颜色改成 #2196F3
  3. 在 Text 里,把 Font 改成 “Fira Code:18”,Non-ASCII Font 改成 “PingFang SC Regular:14” 。

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 插件:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone git://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

编辑 ~/.zshrc 文件 plugin 行,添加插件:

plugins=(git zsh-syntax-highlighting zsh-autosuggestions vscode sublime last-working-dir)

保存退出后,执行 source ~/.zshrc

MacVim

安装好 MacVim 后,可以在 ~/.zshrc 中加入以下命令:

# Alias - Macvim
alias vi="/Applications/MacVim.app/Contents/MacOS/Vim"
alias vim="vi"
alias mvim="vi -g"

保存退出后,执行 source ~/.zshrc

Vim 主题

mkdir -p ~/.vim/colors
cd ~/.vim/colors
wget https://raw.githubusercontent.com/gosukiwi/vim-atom-dark/master/colors/atom-dark.vim
wget https://raw.githubusercontent.com/gosukiwi/vim-atom-dark/master/colors/atom-dark-256.vim

Vim 配置

  • .vimrc TUI 版 Vim 的配置文件
set nocompatible		" Make vim behave more useful way

"--------------- Themes and color ---------------
set t_CO=256			" Number of colors in terminal
colorscheme atom-dark-256	" My Vim TUI color scheme
syntax on			" Enable syntax highlighting

"--------------- UI tweaks ---------------
set guifont=Fira_Code:h18	" Monospaced font with programming ligatures
set macligatures		" Display programming ligatures
set linespace=16
set number			" Show line numbers
set cursorline			" Highlight current line
filetype indent on		" Load filetype-specific indent files
set noerrorbells		" Disable bell for errors that display messages
set vb t_vb=			" Disable bell for errors that do not display messages
set guioptions-=l		" Hide left scroll bar
set guioptions-=L		" Hide left scroll bar in splitted window
set guioptions-=r		" Hide right hand scroll bar
set guioptions-=R		" Hide right hand scroll bar in splitted window
set showmatch			" Highlight matching {[()]} automatically
set wildmenu			" Visualize autocomplete menu for command
set scrolljump=5		" Lines to scroll when cursor leaves screen
set scrolloff=3			" Minium lines to keep above and below the cursor
set laststatus=2		" Always display status line
set ruler			" Display the line and column of the cursor in status bar

"--------------- Indentation ---------------
set tabstop=4			" Number of spaces per tab
set shiftwidth=4		" Indent 4 columns for << and >> operations
set expandtab			" Replace tab with space
set autoindent			" Indent at the same level of the previous line

"--------------- Searching ---------------
set hlsearch			" Highlight search result
set incsearch			" Search as characters in real time
  • .gvimrc GUI 版 Vim 的配置文件
"--------------- Color config ---------------
colorscheme atom-dark			" My Vim GUI color scheme

"--------------- UI tweaks ---------------
set vb t_vb=				" Disable bell after GUI started

"--------------- Some tweaks of the atom-dark theme ---------------
" Normal fg and bg color
hi Normal	guifg=#eeeeee guibg=#252b3a
" fg and bg color of visual mode
hi Visual	guifg=#cdfbff guibg=#1bb1b2
hi CursorLine	guibg=#2F374D
hi Cursor	guifg=NONE guibg=#2196f3
" bg color of line number column
hi LineNr	guibg=bg
" fg and bg color of current and non current status bar
hi StatusLine	guifg=#526669 guibg=bg
hi StatusLineNC	guifg=#526669 guibg=#252b3a gui=none
 类似资料: