.vimrc 一些配置

" 设置包括vundle和初始化相关的runtime path
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#rc()
call vundle#begin()
" 另一种选择,指定一个vundle安装插件的路径
" call vundle#begin('~/some/path/here')


" 让Vundle管理插件版本,必须添加
Plugin 'gmarik/Vundle.vim'
" Plugin 'VundleVim/Vundle.vim'
" 以下范例用来支持不同的格式插件的安装
" 请将安装的插件的命令放在vundle#begin和vundle#end之间
" github上的插件
" 格式为 Plugin '用户名/插件仓库名'
"
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'mbbill/echofunc'
Plugin 'vim-airline/vim-airline'
Plugin 'spf13/PIV' " PHP Integration environment
Plugin 'ap/vim-css-color'
Plugin 'airblade/vim-gitgutter' " Git status for each line
Plugin 'joonty/vdebug' " DBGP debugger
Plugin 'ervandew/supertab'
Plugin 'evidens/vim-twig'
" Plugin 'ervandew/supertab'
" Plugin 'Valloric/YouCompleteMe'
" Plugin 'Valloric/YouCompleteMe'

Bundle 'davidhalter/jedi-vim'  
" Bundle 'ervandew/supertab'

" Bundle 'Valloric/YouCompleteMe'


call vundle#end()

 

" 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 - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

if has("gui_gtk2")
set guifont=DejaVu\ Sans\ Mono\ 12
end

if has("autocmd")
" Drupal *.module and *.install files.
augroup module
autocmd BufRead,BufNewFile *.module set filetype=php
autocmd BufRead,BufNewFile *.install set filetype=php
autocmd BufRead,BufNewFile *.test set filetype=php
autocmd BufRead,BufNewFile *.inc set filetype=php
autocmd BufRead,BufNewFile *.profile set filetype=php
autocmd BufRead,BufNewFile *.view set filetype=php
autocmd BufRead,BufNewFile *.theme set filetype=php
augroup END
endif
syntax on

autocmd FileType php set omnifunc=phpcomplete#CompletePHP

let php_parent_error_close = 1
let php_parent_error_open = 1
let php_folding = 1


" NERDTree配置
map <C-n> :NERDTreeToggle<CR>
" Tagbar
" nmap <F8> :TagbarToggle<CR>
" 在 vim 启动的时候默认开启 NERDTree(autocmd 可以缩写为 au)
" autocmd VimEnter * NERDTree
" 将 NERDTree 的窗口设置在 vim 窗口的右侧(默认为左侧)
" let NERDTreeWinPos="right"
" 当打开 NERDTree 窗口时,自动显示 Bookmarks
let NERDTreeShowBookmarks=1
" 鼠标点击选择目录,鼠标右键不能使用
" :set mouse=a


" Airline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => YouCompleteMe  代码自动补全
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Bundle 'Valloric/YouCompleteMe'
" youcompleteme  默认tab  s-tab 和自动补全冲突
" let g:ycm_key_list_select_completion=['<c-n>']
" let g:ycm_key_list_select_completion = ['<Down>']
" let g:ycm_key_list_previous_completion=['<c-p>']
" let g:ycm_key_list_previous_completion = ['<Up>']
set completeopt=longest,menu
let g:ycm_confirm_extra_conf=0    " 关闭加载.ycm_extra_conf.py提示
let g:ycm_complete_in_comments = 1    "在注释输入中也能补全
let g:ycm_complete_in_strings = 1    "在字符串输入中也能补全
let g:ycm_collect_identifiers_from_tags_files=1    " 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1    "注释和字符串中的文字也会被收入补全
let g:ycm_seed_identifiers_with_syntax=1   "语言关键字补全, python关键字都很短,所以,需要的自己打开
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_min_num_of_chars_for_completion=2    " 从第2个键入字符就开始罗列匹配项
" let g:ycm_path_to_python_interpreter='/usr/bin/python'
" 引入,可以补全系统,以及python的第三方包 针对新老版本YCM做了兼容
" old version
if !empty(glob("~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py"))
    let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py"
endif
" new version
if !empty(glob("~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py"))
    let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py"
endif

" mapping
nmap <leader>gd :YcmDiags<CR>
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>           " 跳转到申明处
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>            " 跳转到定义处
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>

" 直接触发自动补全
let g:ycm_key_invoke_completion = '<C-Space>'
" 黑名单,不启用
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1,
\ 'gitcommit' : 1,
\}


" 0 - 不记录上次的补全方式
" 1 - 记住上次的补全方式,直到用其他的补全命令改变它
" 2 - 记住上次的补全方式,直到按ESC退出插入模式为止
let g:SuperTabRetainCompletionType=2

let g:SuperTabDefaultCompletionType = "context"  
let g:jedi#popup_on_dot = 0

" PYTHON
" let g:ycm_python_binary_path = '/usr/bin/python3'


" search
set incsearch
"set highlight    " conflict with highlight current line
set ignorecase
set smartcase

" enable syntax hightlight and completion
syntax on

" encoding dectection
set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1

" enable filetype dectection and ft specific plugin/indent
" filetype plugin indent on

"-----------------
"" Plugin settings
"-----------------
"" Rainbow parentheses for Lisp and variants
let g:rbpt_colorpairs = [
    \ ['brown',       'RoyalBlue3'],
    \ ['Darkblue',    'SeaGreen3'],
    \ ['darkgray',    'DarkOrchid3'],
    \ ['darkgreen',   'firebrick3'],
    \ ['darkcyan',    'RoyalBlue3'],
    \ ['darkred',     'SeaGreen3'],
    \ ['darkmagenta', 'DarkOrchid3'],
    \ ['brown',       'firebrick3'],
    \ ['gray',        'RoyalBlue3'],
    \ ['black',       'SeaGreen3'],
    \ ['darkmagenta', 'DarkOrchid3'],
    \ ['Darkblue',    'firebrick3'],
    \ ['darkgreen',   'RoyalBlue3'],
    \ ['darkcyan',    'SeaGreen3'],
    \ ['darkred',     'DarkOrchid3'],
    \ ['red',         'firebrick3'],
    \ ]
let g:rbpt_max = 16
autocmd Syntax lisp,scheme,clojure,racket RainbowParenthesesToggle

" tabbar
" let g:Tb_MaxSize = 2
" let g:Tb_TabWrap = 1

" easy-motion
let g:EasyMotion_leader_key = '<Leader>'

" Tagbar
let g:tagbar_left=1
let g:tagbar_width=30
let g:tagbar_autofocus = 1
let g:tagbar_sort = 0
let g:tagbar_compact = 1
" tag for coffee

if executable('coffeetags')
      let g:tagbar_type_coffee = {
              \ 'ctagsbin' : 'coffeetags',
              \ 'ctagsargs' : '',
              \ 'kinds' : [
              \ 'f:functions',
              \ 'o:object',
              \ ],
              \ 'sro' : ".",
              \ 'kind2scope' : {
              \ 'f' : 'object',
              \ 'o' : 'object',
              \ }
              \ }

let g:tagbar_type_markdown = {
    \ 'ctagstype' : 'markdown',
    \ 'sort' : 0,
    \ 'kinds' : [
        \ 'h:sections'
    \ ]
    \ }
endif


" vim配置
set nocompatible  " 去除vi一致性,必须添加                                      
filetype off      " 必须添加
" set number
set hlsearch
" filetype indent on    "auto indent
set fileencodings=ucs-bom,utf-8,gbk,default,latin1
set encoding=utf-8
colorscheme desert


" set expandtab
" set tabstop=4
" set shiftwidth=4
" set autoindent
" set smartindent

" Map Ctrl-s to save
noremap <silent> <C-s> :update<CR>
vnoremap <silent> <C-s> <C-c>:update<CR>
inoremap <silent> <C-s> <C-o>:update<CR>

" 语法高亮度显示  
syntax on
" 设置历史的行数  
set history=1000

" editor settings
set history=1000
set nocompatible
set nofoldenable                                                  " disable folding"
set confirm                                                       " prompt when existing from an unsaved file
" set backspace=indent,eol,start                                    " More powerful backspacing
set t_Co=256                                                      " Explicitly tell vim that the terminal has 256 colors 高亮列  "
" set mouse=a                                                       " use mouse in all modes
set report=0                                                      " always report number of lines changed                "
set nowrap                                                        " dont wrap lines
set scrolloff=5                                                   " 5 lines above/below cursor when scrolling
" set number                                                        " show line numbers
set showmatch                                                     " show matching bracket (briefly jump)
set showcmd                                                       " show typed command in status bar
set title                                                         " show file in titlebar
set laststatus=2                                                  " use 2 lines for the status bar
set matchtime=2                                                   " show matching bracket for 0.2 seconds
set matchpairs+=<:>                                               " specially for html
" set relativenumber


"--------
"" Vim UI
"--------
"" color scheme
set background=dark

" highlight current line 高亮当前行 "                                                                                                            
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline cursorcolumn
set cursorline cursorcolumn

hi Tb_Normal guifg=white ctermfg=white
hi Tb_Changed guifg=green ctermfg=green
hi Tb_VisibleNormal ctermbg=252 ctermfg=235
hi Tb_VisibleChanged guifg=green ctermbg=252 ctermfg=white


" eggcache vim
nnoremap ; :
:command W w
:command WQ wq
:command Wq wq
:command Q q
:command Qa qa
:command QA qa

" w!! to sudo & write a file
cmap w!! %!sudo tee >/dev/null %

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值