Skip to content

Instantly share code, notes, and snippets.

@hpcx82
Created April 6, 2011 13:57
Show Gist options
  • Save hpcx82/905684 to your computer and use it in GitHub Desktop.
Save hpcx82/905684 to your computer and use it in GitHub Desktop.
My vim configuration file
if(has("win32") || has("win95") || has("win64") || has("win16")) "判定当前操作系统类型
let g:iswindows=1
else
let g:iswindows=0
endif
set nocompatible "不要vim模仿vi模式,建议设置,否则会有很多不兼容的问题
syntax on"打开高亮
if has("autocmd")
filetype plugin indent on "根据文件进行缩进
augroup vimrcEx
au!
autocmd FileType text setlocal textwidth=78
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
"智能缩进,相应的有cindent,官方说autoindent可以支持各种文件的缩进,但是效果会比只支持C/C++的cindent效果会差一点,但笔者并没有看出来
set autoindent " always set autoindenting on
endif " has("autocmd")
set tabstop=4 "让一个tab等于4个空格
set vb t_vb=
set nowrap "不自动换行
set hlsearch "高亮显示结果
set incsearch "在输入要搜索的文字时,vim会实时匹配
set backspace=indent,eol,start whichwrap+=<,>,[,] "允许退格键的使用
if(g:iswindows==1) "允许鼠标的使用
"防止linux终端下无法拷贝
if has('mouse')
set mouse=a
endif
au GUIEnter * simalt ~x
else
if exists(":winpos") == 2
winpos 0 0
endif
set lines=99999 columns=99999
endif
set number "显示行号。
set cursorline "高亮显示当前行
set guioptions-=T "去除vim的GUI版本中的toolbar
colorscheme evening
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment