欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

vim的配置文件

程序员文章站 2024-02-21 10:03:16
...

记录一下。

source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

"----------------------------- 配置,双引号后面为注释掉的内容 ---------------------------------
"显示中文不乱码
let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936,chinese,ucs-bom

"永久显示行号
set nu!

"colorscheme evening    "配色方案

set tabstop=4       "设置tab的跳数
set autoread        "设置当文件在外部被修改,自动更新该文件
set mouse=a         "设置在任何模式下鼠标都可用
set nobackup        "设置不生成备份文件

"设置不生成 .un 文件
set noundofile
set nobackup
set noswapfile

"===========================
"查找/替换相关的设置
"===========================
set hlsearch "高亮显示查找结果
set incsearch "增量查找
 
"===========================
"状态栏的设置
"===========================
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%] "显示文件名:总行数,总的字符数
set ruler "在编辑过程中,在右下角显示光标位置的状态行
"
"===========================
"代码设置
"===========================
syntax enable "打开语法高亮
syntax on "打开语法高亮
set showmatch "设置匹配模式,相当于括号匹配
set smartindent "智能对齐
"set shiftwidth=4 "换行时,交错使用4个空格
set autoindent "设置自动对齐
set ai! "设置自动缩进
"set cursorcolumn "启用光标列
set cursorline  "启用光标行
set guicursor+=a:blinkon0 "设置光标不闪烁
set fdm=indent  "代码缩进折叠 

"===========================
"多文件编辑
"===========================
"let g:miniBufExplMapCTabSwitchBufs=1
"let g:miniBufExplMapWindowsNavVim=1
"let g:miniBufExplMapWindowNavArrows=1

转载于:https://www.jianshu.com/p/6dc7db3dc34d