"----Encoding setting---- set encoding=utf-8 "編碼設置 set ffs=unix,dos,mac "設置保存系統格式 set langmenu=zh_CN.utf-8 "中文菜單界面 language messages zh_CN.utf-8 "中文提示界面 "----Basic function---- set nu "顯示行號 set nowb "禁止自動保存 set nocp "去除vi一致性 set ruler "顯示標尺 set nobackup "禁止緩衝保存 set showmatch "符號自動匹配 set incsearch "搜索加強模式 set noswapfile "去除swap文件 set history=700 "設置最大歷史記錄 set autochdir "設置爲當前文件目錄 set backspace=indent,eol,start "去除鍵設置 "----Mouse setting---- set mouse=a "開啓鼠標模式 set selection=exclusive set selectmode=mouse,key "----Indent habit---- set nowrap "不自動換行 set cindent "C格式縮進 set smarttab "智能tab set expandtab "tab用空格代替 set tabstop=4 "一個tab=4個字符 set autoindent "自動縮進 set smartindent "智能縮進 set backspace=2 " set shiftwidth=4 " set softtabstop=4 "按一次tab 前進4個字符 set textwidth=80 "超過80個字符自動換行 "---Auto Complete---- "三種括號自動補全 "inoremap { {<CR>}<ESC>kA<CR> "inoremap ( ()<ESC>i "inoremap [ []<ESC>i "一鍵ctrl+s保存 map <C-s> <ESC>:wall<CR> "一鍵F9保存 map <F9> <ESC>:wall<CR> "一鍵分屏打開in.txt/out.txt並自動調整大小 map <F10> <ESC>:vs out.txt<CR><C-w>L<ESC>:sp in.txt<CR><C-w>h<C-w>20><CR> "一鍵運行run.bat批處理 map <F5> <ESC>:! run.bat<CR> "----Theme setting---- syntax on "開啓高亮 syntax enable "使用高亮 colorscheme desert "主題配色 set background=dark "背景暗色 "set guifont=DejaVu\ Sans\ Mono\ 14 "字體設置 for linux set guifont=DejaVu\ Sans\ Mono:h14 "字體設置 for win "----Autoread the text---- filetype on "自動識別文件類型 if exists("&autoread") "自動讀取修改文件 set autoread endif "----Open with maxwindow in Win32---- if has('win32') au GUIEnter * simalt ~x else au GUIEnter * call MaximizeWindow() endif function! MaximizeWindow() silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz endfunction