"设置编码
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set fileformats=unix,dos,mac
set termencoding=utf-8
set formatoptions+=m
set formatoptions+=B
"显示行号
set ruler " show the current row and column "set number " show line numbers "set nowrap
set showcmd " display incomplete commands "set showmode " display current modes "set showmatch " jump to matches when entering parentheses "set matchtime=2
"突出显示光标
set cursorcolumn
set cursorline
"Tab制表符设置
set expandtab " expand tabs to spaces "set smarttab
set shiftround
"查找配置
set hlsearch " highlight searches "
set incsearch "do incremental searching, search as you type"
set ignorecase " ignore case when searching "
set smartcase " no ignorecase if Uppercase char present "
"其用鼠标
set mouse=a
set selection=exclusive
set selectmode=mouse,key
"显示括号匹配
set showmatch
"设置缩进
set autoindent smartindent shiftround
set shiftwidth=4
set tabstop=4
set softtabstop=4 " insert mode tab and backspace use 4 spaces ""设置粘贴格式
set paste
"显示空格和tab键
set listchars=tab:>-,trail:-
"总是显示状态栏
set laststatus=2
"显示光标当前位置
set ruler
set nocompatible " don't bother with vi compatibility "set autoread " reload files when changed on disk, i.e. via `git checkout` "set shortmess=atI
set magic " For regular expressions turn magic on "set title " change the terminal's title "set nobackup " do not keep a backup file "set noerrorbells " don't beep "set visualbell t_vb=" turn off error beep/flash "set t_vb=set timeoutlen=500
"打开文件类型检测"
filetype on
filetype plugin on
filetype indent on
autocmd FileType python set tabstop=4 shiftwidth=4 expandtab ai
autocmd FileType ruby set tabstop=2 shiftwidth=2 softtabstop=2 expandtab ai
autocmd BufRead,BufNew *.md,*.mkd,*.markdown set filetype=markdown.mkd
autocmd BufNewFile *.py,*.sh exec":call AutoSetFileHead()"
function! AutoSetFileHead()" .sh "if&filetype =='sh'
call setline(1, "\#!/bin/bash")
endif
" python "if&filetype =='python'
call setline(1, "\#!/usr/bin/env python")
call append(1, "\# encoding: utf-8")
endif
normal G
normal o
normal o
endfunc
autocmd FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yml,perl autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
fun!<SID>StripTrailingWhitespaces()let l = line(".")let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun