ubuntu14.04在Vim上配置Python開發環境

A 安裝Vim

sudo apt-get install vim
  • 1

B 在用戶主目錄創建bundle文件夾

mkdir -p ~/.vim/bundle
  • 1

C 安裝Vundle

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle  
  • 1

D 創建或編輯用戶目錄下的.vimrc文件,添加如下內容:

    set nocompatible  
    set rtp+=~/.vim/bundle/vundle/  
    call vundle#rc()  

    " let Vundle manage Vundle  
    " required!  
    Bundle 'gmarik/vundle'  

    " The bundles you install will be listed here  
    Bundle 'scrooloose/nerdtree'  
    Bundle 'davidhalter/jedi-vim'  

    filetype plugin indent on  

    " The rest of your config follows here.  

    augroup vimrc_autocmds  
    autocmd!  
    " highlight characters past column 120  
    autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black  
    autocmd FileType python match Excess /\%120v.*/  
    autocmd FileType python set nowrap  
    augroup END  

    " NerdTree Shortcut.  
    map <f2> :NERDTreeToggle<cr>  

    " automatically change window’s cwd to file’s dir  
    set autochdir  
    autocmd vimenter * NERDTree  " 當打開vim時就顯示NERDTree 可以通過F2來打開或關閉它

    " Prefer spaces to tabs  
    set tabstop=4  
    set shiftwidth=4  
    set expandtab  
    set nu!  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

E 打開vim,鍵入命令“:BundleInstall”,等待自動安裝插件完成(下面顯示“done”)

F 使用方法


例如: vim hello.py
左邊是NERDTree


當按下F2時就可以關掉NERDTree(如果你屏幕小的話),如下:
無NERDTree

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章