我的vimrc

update: 请使用开箱即用的https://spacevim.org/

效果图

2018-06-30 19-03-00屏幕截图.png

  • vim8
  • vim-plug
  • YCM
  • autopep8
  • nerdtree
  • LeaderF
  • ...

syntax enable
set encoding=utf-8
set hlsearch
set smartindent
set nu
colorscheme molokai
set ts=4
set autoindent
set expandtab
set shiftwidth=4
set cursorline
set showmatch
let python_highlight_all=1

let g:mapleader = "\"
set nocompatible              " be iMproved, required
filetype off                  " required

" vim-plug 
call plug#begin("~/.vim/plugged")
" NERD tree will be loaded on the first invocation of NERDTreeToggle command
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'majutsushi/tagbar'
Plug 'powerline/fonts'
Plug 'tell-k/vim-autopep8'
Plug 'nvie/vim-flake8'
Plug 'tomasr/molokai'
Plug 'morhetz/gruvbox'
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'kana/vim-textobj-user'
Plug 'tpope/vim-fugitive'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-syntax'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'kana/vim-textobj-function', { 'for':['c', 'cpp', 'vim', 'java'] }
Plug 'tmhedberg/simpylfold'
Plug 'raimondi/delimitmate'
Plug 'sgur/vim-textobj-parameter'

Plug 'Yggdroot/LeaderF', {'do': './install.sh'}
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'liuchengxu/space-vim-dark'
" Multiple commands
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity']}
" Multiple file types
Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer' }

call plug#end()

nnoremap  
nnoremap  
nnoremap  
nnoremap  

" Enable folding
set foldmethod=indent
set foldlevel=99
nnoremap  za
nnoremap  :YcmForceCompileAndDiagnostics
filetype plugin indent on    " required

let g:SimpylFold_docstring_preview=1

let g:ycm_autoclose_preview_window_after_completion=1
map g  :YcmCompleter GoToDefinitionElseDeclaration
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

map  :NERDTreeToggle
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
 exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
 exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction

call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow','#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')

" Trigger configuration. Do not use  if you use
" https://github.com/Valloric/YouCompleteMe.
" 代码片段设置
let g:UltiSnipsExpandTrigger=""
let g:UltiSnipsJumpForwardTrigger=""
let g:UltiSnipsJumpBackwardTrigger=""
"
" " If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

nnoremap h :YcmCompleter GoToInclude
nnoremap d :YcmCompleter GoToDefinition
nnoremap c :YcmCompleter GoToDeclaration

let g:ycm_add_preview_to_completeopt = 0
let g:ycm_show_diagnostics_ui = 0
let g:ycm_server_log_level = 'info'
let g:ycm_min_num_identifier_candidate_chars = 2
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_complete_in_strings=1
let g:ycm_key_invoke_completion = ''
set completeopt=menu,menuone

noremap  

let g:ycm_semantic_triggers =  {
            \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
            \ 'cs,lua,javascript': ['re!\w{2}'],
            \ }


" minimap 设置
let g:minimap_highlight='Visual'
let g:minimap_show='ms'
let g:minimap_update='mu'
let g:minimap_close='gc'
let g:minimap_toggle='gt'

" 记录文件状态变化
let g:NERDTreeIndicatorMapCustom = {
    \ "Modified"  : "✹",
    \ "Staged"    : "✚",
    \ "Untracked" : "✭",
    \ "Renamed"   : "➜",
    \ "Unmerged"  : "═",
    \ "Deleted"   : "✖",
    \ "Dirty"     : "✗",
    \ "Clean"     : "✔︎",
    \ 'Ignored'   : '☒',
    \ "Unknown"   : "?"
    \ }
    

" LeaderF config
let g:Lf_ShortcutF = ''
let g:Lf_ShortcutB = ''
noremap  :LeaderfMru
noremap  :LeaderfFunction!
noremap  :LeaderfBuffer
noremap  :LeaderfTag
let g:Lf_StlSeparator = { 'left': '', 'right': '', 'font': '' }
 
let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git']
let g:Lf_WorkingDirectoryMode = 'Ac'
let g:Lf_WindowHeight = 0.30
let g:Lf_CacheDirectory = expand('~/.vim/cache')
let g:Lf_ShowRelativePath = 0
let g:Lf_HideHelp = 1
let g:Lf_StlColorscheme = 'powerline'
let g:Lf_PreviewResult = {'Function':0, 'BufTag':0}

" tagbar
nmap  :TagbarToggle

" smart tab line 
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_theme='simple'
let g:airline_powerline_fonts = 1

" molokia 
let g:molokai_original = 1

你可能感兴趣的:(我的vimrc)