在windows下改裝gvim為python的IDE


 

 

在windows下改裝gvim為python的IDE

  1. Reference:
  2. 需要下載的vim編輯器與python
  3. 對vim與python的安裝
    • 在windows下安裝需要自己設置好安裝位置以便安裝后設置環境變量;
    • 在windows下設置環境變量:控制面板\系統和安全\系統\高級系統設置\環境變量:

windows中的環境變量設置

  1. vim"face"的設置
    • 在vim的安裝目錄下找到vimrc文件,打開后可以重新進行編輯修改,對vim進行設置(設置命令如下)。
set nocompatible  
set number  
syntax enable  
syntax on "打開高亮  
colorscheme desert  
set nocompatible "不要vim模仿vi模式  
set foldmethod=indent "設置折疊  
source $VIMRUNTIME/vimrc_example.vim  
source $VIMRUNTIME/mswin.vim  
behave mswin  

設置后顯示:

  1. *下載plugin:python.vim將其放在vim安裝目錄下的./syntax,再將如下命令加入到vimrc文件中對vim支持的文法環境設置為python並且顯示為高亮。下載鏈接:http://www.vim.org/scripts/script.php?script_id=790*
syntax enable
syntax on
set filetype=python
au BufNewFile,BufRead *.py,*.pyw setf python

設置后顯示:

  1. 設置縮進(對vimrc修改的命令如下)
set autoindent " same level indent
set smartindent " next level indent
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
  1. 提供項目視圖:下載plugin:ctags和Tasklist

設置后顯示:

  1. *需要添加自動補全功能,下載插件pythoncomplete.vim(http://www.vim.org/scripts/script.php?script_id=1542)放在插件文件中,對vimrc進行設置的命令如下:*
filetype plugin on
set ofu=syntaxcomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType python runtime! autoload/pythoncomplete.vim
  1. 對python的函數自動補全,<Tab>實現
    • 下載Pydiction后解壓,把python-pydiction.vim文件拷貝到../ftplugin中,把complete-dict拷貝到../tools/pydiction中(如果文件夾不存在,需要自己新建)。

安裝完成后在vimrc文件中設置名列如下:

"設置PythonDict用Tab自動補全功能  
filetype plugin on   
let g:pydiction_location = 'D:\Program Files\vim\vim73\tools\pydiction\complete-dict'  
let g:pydiction_menu_height = 20  

最終可以得到的編輯環境界面

Date: 2014-07-14 Mon

Author: fenywei

Org version 7.8.11 with Emacs version 24

Validate XHTML 1.0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM