用~/.vimrc打造一个完整python环境

前端之家收集整理的这篇文章主要介绍了用~/.vimrc打造一个完整python环境前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. set nocompatible " required
  2. filetype off " required
  3.  
  4. " set the runtime path to include Vundle and initialize
  5. set rtp+=~/.vim/bundle/Vundle.vim
  6. call vundle#begin()
  7.  
  8. " alternatively,pass a path where Vundle should install plugins
  9. "call vundle#begin('~/some/path/here')
  10.  
  11. " let Vundle manage Vundle,required
  12. Plugin 'gmarik/Vundle.vim'
  13.  
  14.  
  15. " Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
  16.  
  17. " Split navigations
  18. set splitbelow
  19. nnoremap <C-J> <C-W><C-J>
  20. nnoremap <C-K> <C-W><C-K>
  21. nnoremap <C-L> <C-W><C-L>
  22. nnoremap <C-H> <C-W><C-H>
  23.  
  24. " Enable folding
  25. Plugin 'tmhedberg/SimpylFold'
  26. let g:SimpylFold_docstring_preview=1
  27.  
  28. " PEP8 auto indent
  29. hi BadWhitespace guifg=gray guibg=red ctermfg=gray ctermbg=red
  30. au BufNewFile,BufRead *.py
  31. \ set tabstop=4 |
  32. \ set softtabstop=4 |
  33. \ set shiftwidth=4 |
  34. \ set textwidth=79 |
  35. \ set expandtab |
  36. \ set autoindent |
  37. \ set fileformat=unix
  38.  
  39. au BufNewFile,BufRead *.js,*.html,*.css
  40. \ set tabstop=2 |
  41. \ set softtabstop=2 |
  42. \ set shiftwidth=2
  43.  
  44. Plugin 'vim-scripts/indentpython.vim'
  45.  
  46. au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
  47.  
  48.  
  49. set encoding=utf-8
  50.  
  51. Bundle 'Valloric/YouCompleteMe'
  52.  
  53.  
  54. let g:ycm_autoclose_preview_window_after_completion=1
  55. map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
  56.  
  57.  
  58. "python with virtualenv support
  59. "py << EOF
  60. "import os
  61. "import sys
  62. "if 'VIRTUAL_ENV' in os.environ:
  63. " project_base_dir = os.environ['VIRTUAL_ENV']
  64. " activate_this = os.path.join(project_base_dir,'bin/activate_this.py')
  65. " execfile(activate_this,dict(__file__=activate_this))
  66. " EOF
  67.  
  68.  
  69. Plugin 'scrooloose/syntastic'
  70. Plugin 'nvie/vim-flake8'
  71.  
  72.  
  73. let python_highlight_all=1
  74. Syntax on
  75.  
  76.  
  77. Plugin 'jnurmine/Zenburn'
  78. Plugin 'scrooloose/nerdtree'
  79. Plugin 'jistr/vim-nerdtree-tabs'
  80.  
  81. let NERDTreeIgnore=['\.pyc$','\~$'] "ignore files in NERDTree
  82.  
  83. Plugin 'kien/ctrlp.vim'
  84. set nu
  85.  
  86. Plugin 'Lokaltog/powerline',{'rtp': 'powerline/bindings/vim/'}
  87. set clipboard=unnamed
  88.  
  89.  
  90. """""""""""""""""""""""""
  91. " Quickly Run
  92. """""""""""""""""""""""""
  93. map <F5> :call CompileRunGcc()<CR>
  94. func! CompileRunGcc()
  95. exec "w"
  96. if &filetype == 'c'
  97. exec "!g++ % -o %<"
  98. exec "!time ./%<"
  99. elseif &filetype == 'cpp'
  100. exec "!g++ % -o %<"
  101. exec "!time ./%<"
  102. elseif &filetype == 'sh'
  103. :!time bash %
  104. elseif &filetype == 'python'
  105. exec "!time python2.7 %"
  106. endif
  107. endfunc
  108.  
  109. map lv 0v$
  110.  
  111. Plugin 'tpope/vim-fugitive'
  112.  
  113. " YouCompleteMe
  114. set runtimepath+=~/.vim/bundle/YouCompleteMe
  115. let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎
  116. let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
  117. let g:syntastic_ignore_files=[".*\.py$"]
  118. let g:ycm_seed_identifiers_with_Syntax = 1 " 语法关键字补全
  119. let g:ycm_complete_in_comments = 1
  120. let g:ycm_confirm_extra_conf = 0
  121. let g:ycm_key_list_select_completion = ['<c-n>','<Down>'] " 映射按键,没有这个会拦截tab,导致其他插件tab不能用.
  122. let g:ycm_key_list_prevIoUs_completion = ['<c-p>','<Up>']
  123. let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
  124. let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全
  125. let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
  126. let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
  127. let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查
  128. inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | " 回车即选中当前项
  129. nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>| " 跳转到定义处
  130. "let g:ycm_min_num_of_chars_for_completion=2 "
  131. "从第2个键入字符就开始罗列匹配项
  132.  
  133.  
  134. " All of your Plugins must be added before the following line
  135. call vundle#end() " required
  136. filetype plugin indent on " required

猜你在找的Bash相关文章