Skip to content

Instantly share code, notes, and snippets.

@mcattx
Created February 7, 2018 12:37
Show Gist options
  • Save mcattx/fa3e9032092a7ccb1791045c752efd59 to your computer and use it in GitHub Desktop.
Save mcattx/fa3e9032092a7ccb1791045c752efd59 to your computer and use it in GitHub Desktop.
vim config file
"------------------------------------------------------------------------
" general
"------------------------------------------------------------------------
set history=50 " 历史记录条数
"set number " 显示行号
set confirm " 在处理未保存或只读文件时,弹出确认提示
"------------------------------------------------------------------------
" colors
"------------------------------------------------------------------------
syntax on " 语法高亮
set cursorline "语法高亮当前行,当前行显示一条长线
"------------------------------------------------------------------------
" vim UI
"------------------------------------------------------------------------
set ruler " 在状态栏显示光标位置
set laststatus=2 " 显示状态栏信息
"------------------------------------------------------------------------
" text format/layout
"------------------------------------------------------------------------
" set tabstop=2 " tab 键宽度
"------------------------------------------------------------------------
" text format/layout
"------------------------------------------------------------------------
set showmatch " 显示匹配符号,比如成对的 (), {} 等等
set ignorecase " 搜索时忽略大小写
set smartcase " 搜索时假如有一个大写字母,则切换到大小写敏感查找模式
set incsearch " 搜索输入字符串过程中高亮
set hlsearch " 搜索结果的匹配项高亮
highlight Search ctermbg=yellow ctermfg=black
"highlight IncSearch ctermbg=black ctermfg=yellow
"highlight MatchParen cterm=underline ctermbg=NONE ctermfg=NONE
" 上述配置指定 Search 结果的前景色(foreground)为黑色,背景色(background)" 为>灰色; 渐进搜索的前景色为黑色,背景色为黄色;光标处的字符加下划线。
" 当光标一段时间保持不动了,就禁用高亮
autocmd cursorhold * set nohlsearch
" 当输入查找命令时,再启用高亮
noremap n :set hlsearch<cr>n
noremap N :set hlsearch<cr>N
noremap / :set hlsearch<cr>/
noremap ? :set hlsearch<cr>?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment