想用 vim 寫 python,python-mode 幫你搞定[視頻]

vim 是筆者常用的一個編輯器(目前轉到了 neovim,neovim 配置),結合 tmux、iterm2、zsh、autojump 等命令行工具和 Dash,Alfread 等工具就能在終端下愉快開發了。在 vim 下寫 python 一般有兩個常用的插件,一個是 python-mode,一個是 jedi-vim。筆者選擇了 python-mode,因為它功能很強大,筆者的一套配置在伺服器和本地開發幾乎就是一樣的體驗。python-mode 功能很全,補全、重構、靜態檢查、自動格式化等都有,看下官網的特性:

Why Python-mode?

  1. Be more productive: Pymode saves time by bring all tools necessary for professional developers so that you can focus on bigger things. It has been finely tuned based on decades of experience working with Vim and is constantly kept uptodate.
  2. Get smart assistance: Pymode knows all about your code. We use the best-in-class intellisense code completion, on-the-fly error checking and quick-fixes; easy project navigation and much more.
  3. Use the full power and capabilities of Vim: Unlike traditional IDEs which can only provide a small subset of Vim functionalities, you can do everything and anything that you can in Vim.
  4. Modular structure: We attempt to be create Python-mode in the same principles of python: i.e. have a modular structure, so that as and when better libraries evolve, we can provide you the best experience, while abstracting the details so that you can get back to what you do best.
  5. Written mostly in Python: 96.1% written in Python. Well we love Python :)

The plugin contains all you need to develop python applications in Vim.

  • Support Python version 2.6+ and 3.2+
  • Syntax highlighting
  • Virtualenv support
  • Run python code (<leader>r)
  • Add/remove breakpoints (<leader>b)
  • Improved Python indentation
  • Python motions and operators (]], 3[[, ]]M, vaC, viM, daC, ciM, ...)
  • Improved Python folding
  • Run multiple code checkers simultaneously (:PymodeLint)
  • Autofix PEP8 errors (:PymodeLintAuto)
  • Search in python documentation (<leader>K)
  • Code refactoring
  • Intellisense code-completion
  • Go to definition (<C-c>g)
  • And more, more ...

下面是某不可見網站的示例視頻,大家可以看下:

https://www.zhihu.com/video/937270284336828416
推薦閱讀:

SpaceVim release v0.6.0
輕鬆使用cscope-tags-vim瀏覽C/C++源代碼
vim 啟動速度優化的一些經驗
Vim - 配置IDE一般的python環境

TAG:Vim | Vim插件 | Python开发 |