首页 > 代码库 > My Vimrc
My Vimrc
""""""""""""""""""""""""""""""
" functions
""""""""""""""""""""""""""""""
"distinguish system platforms
function! MySys()
if has("win32")
return "windows"
else
return "linux"
endif
endfunction
""""""""""""""""""""""""""""""
" distingguish system platforms
""""""""""""""""""""""""""""""
"for windows version
if MySys()=="windows"
" source $VIMRUNTIME/mswin.vim
" behave mswin
else
endif
""""""""""""""""""""""""""""""
" common settings
""""""""""""""""""""""""""""""
set nocompatible
set number "open line number
set cursorline "highlight current line
set ruler "show rule state
set hlsearch "highlight search
syntax on "syntax enable
filetype on "调用$vimRUNTIME/filetype.vim根据文件名判断文件类型,如果失败会调用$vimRUNTIME/scripts.vim根据文件的内容判断
filetype plugin on "执行$vimRUNTIME/ftplugin.vim根据检测到的文件类型在runtimepath中搜索相应插件执行
filetype indent on "加载$vimRUNTIME/indent.vim根据检测到的文件类型在runtimepath/indent中搜索相应的缩进格式
let mapleader="," "set mapleader
set sessionoptions=blank,buffers,sesdir,folds,help,options,tabpages,winsize "make session options
""""""""""""""""""""""""""""""
" plugins
""""""""""""""""""""""""""""""
" BufExplorer
let g:bufExplorerDefaultHelp=0 "Do not show default help.
let g:bufExplorerShowRelativePath=1 "Show relative paths.
let g:bufExplorerSortBy=‘mru‘ "Sort by most recently used.
let g:bufExplorerSplitRight=0 "Split left.
let g:bufExplorerSplitVertical=1 "Split vertically.
let g:bufExplorerSplitVertSize = 30 "Split width
let g:bufExplorerUseCurrentWindow=1 "Open in new window.
autocmd BufWinEnter \[Buf\ List\] setl nonumber
""""""""""""""""""""""""""""""
" gui settings
""""""""""""""""""""""""""""""
if has("gui_running")
" set guioptions-=m " 关闭菜单栏
" set guioptions-=T " 关闭工具栏
" set guioptions-=l " 关闭左边滚动条
" set guioptions-=L " 关闭垂直分隔窗口左边滚动条
" set guioptions-=r " 关闭右边滚动条
" set guioptions-=R " 关闭垂直分隔窗口右边滚动条
"
set lines=40 columns=90
set guifont=Consolas\:h11\:cANSI
color evening "color
endif
""""""""""""""""""""""""""""""
" custom key settings
""""""""""""""""""""""""""""""
map <silent> <leader>ss :source $VIM/_vimrc "reload vimrc
map <silent> <leader>ee :e $VIM/_vimrc "edit vimrc
autocmd! bufwritepost _vimrc source $VIM/_vimrc "when vimrc was edited, auto reload it