现在的位置: 首页 > 综合 > 正文

vim配置文件vimrc

2019年10月02日 ⁄ 综合 ⁄ 共 1525字 ⁄ 字号 评论关闭

我的.vimrc文件:

"explicitly get out of vi-compatible mode
set nocompatible 

"don't use local version of .(g)vimrc, .exrc
set noexrc 

"we plan to use a dark background
set background=dark
"set cpoptions=aABceFsmq

"syntax highlighting on
syntax on

"load filetype plugins/indent setting
filetype plugin indent on

"always switch to the current file directory
set autochdir

"make backspace a more flexible
set backspace=indent,eol,start

"use mouse everywhere
set mouse=a

"don't make noise
set noerrorbells

"set whichwrap=b,s,<,>,~,[,]

"turn on command line completion wild styl
"set wildmenu

"turn on wild mode huge list
"set wildmode=list:longest

"highlight the current colum
"set cursorcolumn
"highlight current line
"set cursorline

"BUT do highlight as you type you search phras
set incsearch

"always show the status line
"set laststatus=2

"do not redraw while running macro
set lazyredraw

"don't blink
set novisualbell

"tell us when anything is changed via :..
set report=0

"Always show current positions along the bottom
set ruler

"show the command being typed
set showcmd

"show matching brackets
set showmatch

"set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]


" no real tabs please!
set expandtab

"Automatically insert comment leader on return, and let gq format comments
set formatoptions=rq
"case insensitive by default
set ignorecase

"do not wrap line
set nowrap

set paste
set shiftwidth=4
set softtabstop=4
set tabstop=4

inoremap ( ()<ESC>i
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap { {}<ESC>i
inoremap } <c-r>=ClosePair('}')<CR>
inoremap [ []<ESC>i
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap < <><ESC>i
inoremap > <c-r>=ClosePair('>')<CR>

function ClosePair(char)
    if getline('.')[col('.') - 1] == a:char
        return "\<Right>"
    else
        return a:char
    endif
endf

抱歉!评论已关闭.