自己因为使用vim比较多,并且很喜欢这个文本编辑器,为了应对在不同机器上面作业的情况,我需要记录自己习惯的配置
set number "显示行号
set tabstop=4 "Tab键的宽度
set syntax=on "语法高亮
set nocompatible "不跟vi兼容
"自动缩进
set autoindent
set cindent
"统一缩进为4
set softtabstop=4
set shiftwidth=4
set noexpandtab "不要用空格代替制表符
set hlsearch "高亮显示搜索字符
set incsearch "逐字搜索字符
set ignorecase "搜索忽略大小写
set t_Co=256
set backspace=indent,eol,start "解决退格键有时候会失效问题
set showmatch "高亮显示匹配的括号
set smartindent "为C程序提供自动缩进
set completeopt=longest,menu "打开文件类型检测,加了这句才可以使用智能补全。
inoremap { {}<esc>i
inoremap ( ()<esc>i
inoremap [ []<esc>i
inoremap " ""<esc>i
inoremap ' ''<esc>i
这些都是一些最基本的配置,在今后的工作中可能会用到其他更多的插件或者映射,以后会对这个文件进行补充。
补充:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdcommenter'
Plugin 'tomasr/molokai'
Plugin 'bling/vim-airline'
call vundle#end()
filetype plugin indent on
set number
set tabstop=4
set autoindent
set cindent
set softtabstop=4
set shiftwidth=4
set expandtab
set hlsearch
set incsearch
syntax on
set t_Co=256
set backspace=indent,eol,start
set smartindent
set completeopt=longest,menu
"set colorcolumn=100
let mapleader=","
colorscheme molokai
let g:ycm_global_ycm_extra_conf="/home/lsg/.vim/.ycm_extra_conf.py"
let g:ycm_server_python_interpreter="/usr/bin/python3"
let g:ycm_seed_identifiers_with_syntax=1
let g:ycm_add_preview_to_completeopt=1
let g:ycm_show_diagnostics_ui=0
let g:ycm_semantic_triggers = {
\ 'c,cpp,python,java,go,erlang,perl':['re!\w{2}'],
\ 'cs,lua,jvascript':['re!\w{2}'],
\}
let g:go_def_mode='godef'
"if exists('$TMUX')
" set term=screen-256color
"endif
inoremap { {}<esc>i
inoremap ( ()<esc>i
inoremap [ []<esc>i
inoremap " ""<esc>i
inoremap ' ''<esc>i
在git上面有很多很好的参照:Vimrc