vim 配置文件vimrc(二)

set fileencodings=utf-8
set termencoding=utf-8
ab .m #include int main(int argc, char *argv[]){ return 0;}
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 :TlistToggle

"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

"switch between buffers
nmap wn :bn
nmap wp :bp

"delete between buffers
nmap wd :bd

"fast saving--local
nmap ww :w

"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 :Grep

"omni-completion
"filetype plugin indent on
"map supertab
"let g:SuperTabRetainCompletionType=2
"let g:SuperTabDefaultCompletionType=""

"other maps
""inoremap             
""""imap

"ctags jump
"inoremap               
"inoremap             

 

"highlight CurrentLine guibg=darkgrey guifg=white
"au! Cursorhold * exe ‘match CurrentLine /\%’ . line(‘.’) . ‘l.*/’
"set ut=100

"commnent
""vmap :call EnhancedCommentify('yes','comment',line("'<"),line("'>"))
""vmap :call EnhancedCommentify('yes','decomment',line("'<"),line("'>"))

"F5 添加注释
vmap :s=^\(//\)*=//=g:noh
nmap :s=^\(//\)*=//=g:noh
imap :s=^\(//\)*=//=g:noh

"F6 for uncomment
vmap :s=^\(//\)*==g:noh
nmap :s=^\(//\)*==g:noh
imap :s=^\(//\)*==g:noh

"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 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 ( ()i
:inoremap ) =ClosePair(')')
:inoremap { {}i
:inoremap } =ClosePair('}')
:inoremap [ []i
:inoremap ] =ClosePair(']')
":inoremap < <>i
":inoremap > =ClosePair('>')
":inoremap ' ''i

function ClosePair(char)
 if getline('.')[col('.') - 1] == a:char
  return "\"
 else
  return a:char
 endif
endf
set nu
set ru

 

你可能感兴趣的:(centos,与ubuntu配置集锦)