My Vim Configuration


"vundle
set nocompatible              " be iMproved, required
filetype off                  " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} "状态行格式
set laststatus=2 "2总是显示状态行
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.

" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'

" 自动补全插件
Plugin 'Valloric/YouCompleteMe'

"目录树插件
Plugin 'scrooloose/nerdtree'

" 列出文件内索引目录
"
"
"
Plugin 'Valloric/ListToggle'

" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'

" git repos on your local machine (i.e. when working on your own plugin)
"Plugin 'file:///home/gmarik/path/to/plugin'

" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

" Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end()            " required

filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

"-----------------------------------------------------
set completeopt=longest,menu  "让Vim的补全菜单行为与一般IDE一致(参考VimTip1228)
autocmd InsertLeave * if pumvisible() == 0|pclose|endif "离开插入模式后自动关闭预览窗口
inoremap         pumvisible() ? "\" : "\"  "回车即选中当前项
"上下左右键的行为 会显示其他信息
inoremap       pumvisible() ? "\" : "\"
inoremap         pumvisible() ? "\" : "\"
inoremap   pumvisible() ? "\\\" : "\"
inoremap     pumvisible() ? "\\\" : "\"


let g:ycm_collect_identifiers_from_tags_files=1 " 开启 YCM 基于标签引擎
let g:ycm_min_num_of_chars_for_completion=2 " 从第2个键入字符就开始罗列匹配项
let g:ycm_cache_omnifunc=0  " 禁止缓存匹配项,每次都重新生成匹配项
let g:ycm_seed_identifiers_with_syntax=1  " 语法关键字补全
nnoremap  :YcmForceCompileAndDiagnostics  "force recomile with syntastic
"nnoremap lo :lopen "open locationlist
"nnoremap lc :lclose  "close locationlist
inoremap  
"在注释输入中也能补全
let g:ycm_complete_in_comments = 1
"在字符串输入中也能补全
let g:ycm_complete_in_strings = 1
"注释和字符串中的文字也会被收入补全
let g:ycm_collect_identifiers_from_comments_and_strings = 0

nnoremap jd :YcmCompleter GoToDefinitionElseDeclaration " 跳转到定义处

"-------------------------------------------------------

set encoding=iso-8859-1
set encoding=utf-8

set cursorline
hi CursorLine cterm=None ctermbg=darkred ctermfg=white guibg=white

"set column color
set cursorcolumn
hi CursorColumn cterm=None ctermfg=white guibg=white

" KEY TOP BOTTOM LEFT RIGHT
set nocompatible
"------------------------------------------------------
" 设置NerdTree
map  :NERDTreeMirror
map  :NERDTreeToggle
"------------------------------------------------------
"VIMIDE vimrc basic settings
"--------start---------
set fileencodings=ucs-bom,utf-8,cp936
set helplang=cn

set list
highlight NonText ctermfg=7
"------ tab width
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab

set nobackup
set noswapfile
set nowb
set backspace=start,indent,eol
set nu!
set wrap
set hlsearch


set noerrorbells
set novisualbell

filetype on
filetype plugin indent on

syntax on
set ruler

"map  :NERDTree
noremap  t :TlistToggle

"map  :TlistToggle
set mouse=a
"autocmd VimEnter * NERDTree
autocmd BufEnter * silent! lcd %:p:h

" buffers
set hidden "in order to switch between buffers with unsaved change
map  :bp
map  :bn
map ,bd :bd

"--------end--------


let Tlist_Auto_Open=1
let Tlist_Show_One_File = 1 "只显示一个文件中的tag,默认为显示多个
let Tlist_Use_Right_Window = 1 "让taglist窗口出现在Vim的右边
let Tlist_File_Fold_Auto_Close = 1 "当同时显示多个文件中的tag时,设置为1,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来。
let Tlist_WinWidth = 32 "设置窗体宽度为32,可以根据自己喜好设置
let Tlist_Ctags_Cmd = '/usr/local/Cellar/ctags/5.8_1/bin/ctags '

let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

"if exists('+colorcolumn')
"    set colorcolumn=80
"    hi ColorColumn guibg=#2d2d2d ctermbg=246
"endif

"highlight OverLength ctermbg=red ctermfg=white guibg=#592929
"match OverLength /\%80v.\+/

你可能感兴趣的:(My Vim Configuration)