~~~
"""""""""""""""""
" => 全局配置 "
"""""""""""""""""
" 關閉兼容模式
set nocompatiblejava
" 設置歷史記錄步數
set history=1024bash
" 開啓文件類型檢測
filetype on
filetype plugin on
filetype indent on工具
" 文件在外部修改時,自動更新該文件
set autoread字體
" 激活鼠標功能
set mouse=aui
"""""""""""""""""""
" => 字體和顏色 "
"""""""""""""""""""
" 開啓語法
syntax enable編碼
" 設置配色
colorscheme desertspa
" 高亮顯示當前行
set cursorline
hi cursorline guibg=#00ff00
hi CursorColumn guibg=#00ff00命令行
""""""""""""""""
" =>代碼摺疊 "
""""""""""""""""
" 開啓代碼摺疊
set foldenableorm
" 配置代碼摺疊方式
set foldmethod=manual繼承
" 設置摺疊區域寬度
set foldcolumn=0
" 設置摺疊層數爲3
setlocal foldlevel=3
" 設置爲自動關閉摺疊
set foldclose=all
" 用空格鍵代替zo和zc快捷鍵實現開關摺疊
nnoremap
"""""""""""""""""
" => 文字處理 "
"""""""""""""""""
" 使用空格替換Tab
set expandtab
" 設置全部Tab和縮進爲4個空格
set tabstop=4
" 設定 << 和 >> 命令移動時的寬度爲4
set shiftwidth=4
" 按退格鍵時一次刪掉4個空格
set softtabstop=4
set smarttab
" 縮進,自動縮進(繼承前一行的縮進)
set ai
" 智能縮進
set si
" 自動換行
set wrap
" 設置軟寬度
set sw=4
""""""""""""""""
" =>Vim 界面 "
""""""""""""""""
" Turn on WiLd menu
set wildmenu
" 設置標尺
set ruler
" 設置命令行高度
set cmdheight=1
" 顯示行數
set number
" Do not redraw, when running macros.. lazyredraw
set lz
" 設置退格
set backspace=eol,start,indent
" Backspace and cursor keys wrap to
set whichwrap+=<,>,h,l
" Set magic on (設置魔術)
set magic
" 關閉遇到錯誤時的聲音提示
" 關閉錯誤信息響鈴
set noerrorbells
" 關閉使用可視響鈴代替呼叫
set novisualbell
" 顯示匹配的括號([{ 和 }])
set showmatch
" How many tenths of a second to blink
set mat=2
" 搜索時高亮顯示匹配到的內容
set hlsearch
"""""""""""""""""
" => 編碼設置 "
"""""""""""""""""
" 設置編碼
set encoding=utf-8
"設置文件編碼
set fileencoding=utf-8
" 設置終端編碼
set termencoding=utf-8
"""""""""""""""""
" => 其餘設置 "
"""""""""""""""""
" 開啓新行時使用智能自動縮進
set smartindent
set cin
set showmatch
" 隱藏工具欄
set guioptions-=T
" 隱藏菜單欄
set guioptions-=m
" 置空錯誤鈴聲的終端代碼
set vb t_vb=
" 顯示狀態欄(默認值爲1,表示沒法顯示狀態欄)
set laststatus=2
" 粘貼不換行問題的解決方法
set pastetoggle=
" 設置背景色
set background=dark
" 設置高亮相關
highlight Search ctermbg=black ctermfg=white guifg=white guibg=black
"hi CursorLine cterm=NONE ctermbg=black ctermfg=white guibg=black guifg=white
" 在Shell腳本開頭自動增長解釋器及做者等版權信息
autocmd BufNewFile .py,.cc,.sh,.java exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1, "#!/bin/bash")
call setline(2, "##############################################")
call setline(3, "#File Name: ".expand("%"))
call setline(4, "#Version: V1.0")
call setline(5, "#Author: ")
call setline(6, "#Created Time: ".strftime("%F %T"))
call setline(7, "#Description: ")
call setline(8, "##############################################")
call setline(9, "")
endif
endfunc
"新建文件後,自動定位到文件末尾
autocmd BufNewFile * normal G
" 設置() [] {} ''自動補齊
inoremap ( ()
inoremap [ []
inoremap { {}
inoremap ' ''
" 顯示Tab和空格
set list
" 設置Tab和空格樣式
set lcs=tab:|\ ,nbsp:%,trail:-
" 設定活動行樣式
"highlight LeaderTab guifg=#666666
"highlight Comment ctermfg=green guifg=green
"hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
"hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
~~~