使用VundleVim定製vim開發環境

shawnloong發表於2017-11-26
1.建議vim版本在7.3以上,檢視vim版本

點選(此處)摺疊或開啟

  1. (py3env) [root@mysqltest-213-2 pytonstudy]# vim --version
  2. VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 21 2016 17:10:41)
  3. Included patches: 1-207, 209-629
  4. Modified by
  5. Compiled by




下載

點選(此處)摺疊或開啟

  1. git clone .git ~/.vim/bundle/Vundle.vim


vim ~/.vimrc 新增如下內容

點選(此處)摺疊或開啟

  1. " show row number
  2. set nu
  3. " " color theme
  4. colorscheme desert
  5. " " 設定encoding,防止亂碼
  6. set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
  7. " """"""""""""""""""""""""""""""
  8. " " Vundle Setting "
  9. " """"""""""""""""""""""""""""""
  10. set nocompatible " be iMproved, required
  11. filetype on " required
  12. " " set the runtime path to include Vundle and initialize
  13. set rtp+=~/.vim/bundle/Vundle.vim
  14. call vundle#begin()
  15. " " let Vundle manage Vundle, required
  16. Plugin 'VundleVim/Vundle.vim'
  17. " "
  18. " " 外掛管理核心庫
  19. Bundle 'gmarik/vundle'
  20. " " 檔案管理器
  21. Plugin 'scrooloose/nerdtree'
  22. map <C-n> :NERDTreeToggle<CR>
  23. " " ctrlp搜尋外掛
  24. Bundle 'ctrlpvim/ctrlp.vim'
  25. let g:ctrlp_map = '<c-p>'
  26. let g:ctrlp_cmd = 'CtrlP'
  27. " " 加強狀態列
  28. Plugin 'bling/vim-airline'
  29. " "程式碼補全
  30. Bundle 'Shougo/neocomplcache'
  31. let g:neocomplcache_enable_at_startup = 1
  32. " " Use smartcase.
  33. let g:neocomplcache_enable_smart_case = 1
  34. " " Set minimum syntax keyword length.
  35. let g:neocomplcache_min_syntax_length = 3
  36. let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
  37. set completeopt-=preview
  38. " " EasyGrep
  39. Plugin 'dkprice/vim-easygrep'
  40. " " 自動格式化
  41. Plugin 'Chiel92/vim-autoformat'
  42. noremap <F3> :Autoformat<CR>
  43. let g:autoformat_autoindent = 1
  44. let g:autoformat_retab = 1
  45. let g:autoformat_remove_trailing_spaces = 1
  46. " " 自動補全括號,引號
  47. Plugin 'Raimondi/delimitMate'
  48. let g:delimitMate_expand_space = 1
  49. let g:delimitMate_expand_cr = 2
  50. let g:delimitMate_expand_space = 1
  51. call vundle#end() " required
  52. filetype plugin indent on " required
  53. " " size of a hard tabstop
  54. set tabstop=4
  55. " " size of an "indent"
  56. set shiftwidth=4
按esc 退出到vim命令模式輸入

點選(此處)摺疊或開啟

  1. :BundleInstall



點選(此處)摺疊或開啟

  1. " Installing plugins to /root/.vim/bundle | 1
  2. . Plugin 'VundleVim/Vundle.vim' |~
  3. . Plugin 'gmarik/vundle' |~
  4. . Plugin 'scrooloose/nerdtree' |~
  5. . Plugin 'ctrlpvim/ctrlp.vim' |~
  6. . Plugin 'bling/vim-airline' |~
  7. . Plugin 'Shougo/neocomplcache' |~
  8. . Plugin 'dkprice/vim-easygrep' |~
  9. . Plugin 'Chiel92/vim-autoformat' |~
  10. . Plugin 'Raimondi/delimitMate' |~
  11. * Helptags |~
  12. |~
  13. ~ |~
  14. ~ |~
  15. ~ |~
  16. ~ |~
  17. ~ |~
  18. ~ |~
  19. ~ |~
  20. ~ |~
  21. ~ |~
  22. ~ |~
  23. ~ |~
  24. ~ |~
  25. ~ |~
  26. Preview [Vundle] Installer vun… 100% ? 12/12 ㏑ : 1 [No Name] 100% ? 0/1 ㏑ : 1
  27. Done!

安裝完成
程式碼事例

點選(此處)摺疊或開啟

  1. (py3env) [root@mysqltest-213-2 pytonstudy]# vim test_su.py

  2.   1 a = 1
  3.   2 a2 = 3
  4.   3 a += a2
  5.   4 print("a2=%d"%(a2))
  6.   5 print("a=%d"%(a))





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24486203/viewspace-2147782/,如需轉載,請註明出處,否則將追究法律責任。

相關文章