vim 配置文件vimrc(二)
set fileencodings=utf-8
set termencoding=utf-8
ab .m #include <stdio.h><cr><cr><cr>int main(int argc, char *argv[])<cr>{<cr><cr><cr> return 0;<cr>}
set nocompatible
set nobackup
set noswapfile
set viminfo+=!
set number
"--ignore case when searching--
"set ignorecase
"unit-1/10s
set matchtime=2
set background=light
"配色方案
colorscheme desert
syntax on "打开高亮
" -- MiniBufferExplorer -- "
"let g:miniBufExplSplitToEdge = 1 "always at top
"let g:miniBufExplorerMoreThanOne = 0 "solve conflict problem
let g:miniBufExplMapWindowNavVim = 1 "map C-[hjkl]
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplUseSingleClick= 1
let g:miniBufExplModSelTarget = 1
"let g:miniBufExplTabWrap = 1 "make tabs show complete
"let g:miniBufExplForceSyntaxEnable = 1
"--Taglist configure--"
"let Tlist_Ctags_Cmd='ctags' "因为我们放在环境变量里,所以可以直接执行
let Tlist_Use_Right_Window=1 "让窗口显示在右边,0的话就是显示在左边
"let Tlist_Show_One_File=0 "让taglist可以同时展示多个文件的函数列表
let Tlist_Show_One_File=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Exit_OnlyWindow=1 "当只有一个文件打开时退出窗口
"let Tlist_Show_Menu = 1 "show Menu
let Tlist_Use_SingleClick= 1 "if single click
"let Tlist_Auto_Open= 1 "auto open
"F8 快速启动
nnoremap <silent> <F8> :TlistToggle<CR>
"neocomplement
"let g:neocomplcache_enable_at_startup = 1
"--ACP--
"let g:acp_enableAtStartup=1
let g:acp_mappingDriven=1 "prevent mouse click causet to move
"--winmanager configure--
"let g:winManagerWindowLayout='FileExplorer|TagList'
let g:winManagerWindowLayout='FileExplorer'
nmap wm :WMToggle<cr>
"switch between buffers
nmap wn :bn<cr><esc>
nmap wp :bp<cr><esc>
"delete between buffers
nmap wd :bd<cr><esc>
"fast saving--local
nmap <silent>ww :w<cr><esc>
"fast editing -- global effective
vmap gc "+y
vmap gx "+x
vmap gp "+gP
nmap gp "+gP
"let mapleader
"let mapleader=","
"let g:mapleader=","
"grep 查找
nnoremap <silent> <F3> :Grep<CR>
"omni-completion
"filetype plugin indent on
"map supertab
"let g:SuperTabRetainCompletionType=2
"let g:SuperTabDefaultCompletionType="<C-X><C-P>"
"other maps
""inoremap <C-A> <C-X><C-P>
""""imap <tab> <C-X><C-P>
"ctags jump
"inoremap <C-[> <C-T>
"inoremap <Tab> <C-X><C-P>
"highlight CurrentLine guibg=darkgrey guifg=white
"au! Cursorhold * exe ‘match CurrentLine /\%’ . line(‘.’) . ‘l.*/’
"set ut=100
"commnent
""vmap <F4> <Esc><Esc>:call EnhancedCommentify('yes','comment',line("'<"),line("'>"))<CR>
""vmap <C-F4> <Esc><Esc>:call EnhancedCommentify('yes','decomment',line("'<"),line("'>"))<CR>
"F5 添加注释
vmap <F5> :s=^\(//\)*=//=g<cr>:noh<cr>
nmap <F5> :s=^\(//\)*=//=g<cr>:noh<cr>
imap <F5> <ESC>:s=^\(//\)*=//=g<cr>:noh<cr>
"F6 for uncomment
vmap <F6> :s=^\(//\)*==g<cr>:noh<cr>
nmap <F6> :s=^\(//\)*==g<cr>:noh<cr>
imap <F6> <ESC>:s=^\(//\)*==g<cr>:noh<cr>
"Let cursor stay in it's old place
"Use the default filetype settings, so that mail gets ‘tw’ set to 72,
"‘cindent’ is on in C files, etc.
" Also load indent files, to automatically do language-dependentindenting.
if has("autocmd")
filetype plugin indent on
" For all text files set ‘textwidth’ to 78 characters.
autocmd FileType text setlocal textwidth=78
"When editing a file, always jump to the last known cursor position.
"Don’t do it when the position is invalid or when inside an event handler
"(happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif "has(“autocmd”)
"===================================="
set tabstop=8
"不自动换行
"set nowrap
"高亮显示结果
set hlsearch
"在输入要搜索的文字时,vim会实时匹配
set incsearch
"允许退格键的使用
set backspace=indent,eol,start whichwrap+=<,>,[,]
"Have the mouse enabled all the time
set mouse=a
"Always show current position
set ruler
"show matching braces
set showmatch
"Enable folding, it's very useful
"set nofen
"set fdl=0
"set foldmethod=indent shit!
set foldenable " 开始折叠
set foldmethod=syntax " 设置语法折叠
set foldcolumn=1 " 设置折叠区域的宽度
setlocal foldlevel=8 " 设置折叠层数为
" 用空格键来开关折叠
set guioptions-=T " 隐藏工具栏
"set guioptions-=m " 隐藏菜单栏
""nmap <silent> <F5> zc
"Auto indent
set autoindent
set cindent
"Auto indent width
set sw=8
"set current cursor hightlight
"if has("gui_running")
"set cursorline
"highlight cursorline guibg=lightblue guifg=black
"highlight currentline guibg=lightblue guifg=black
"endif
"括号和引号自动匹配
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
":inoremap < <><ESC>i
":inoremap > <c-r>=ClosePair('>')<CR>
":inoremap ' ''<ESC>i
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
set nu
set ru