Emacs 安裝 jedi

來源:互聯網
上載者:User

標籤:style   blog   color   使用   os   io   檔案   art   

Jedi 是個很棒的 python 的自動補全外掛程式,可以顯示 docstring, function arguments and code location.

安裝步驟:

一、安裝 python 的虛擬環境
sudo apt-get install python-virtualenv

或

sudo apt-get install python-pipsudo pip install virtualenv
二、安裝 jedi 

在emacs裡操作(一個朋友的協助,乾脆利落):

1. M-x: list-packages

2. C-s jedi  => i => x => y

3. M-x: list-packages

4. C-s exec-path-from-shell => i => x => y

5. restart you emacs

6. M-x: exec-path-from-shell-initialize

7. M-x: jedi:install-server

這樣就安裝好了,然後是配置:

;; jedi(autoload ‘jedi:setup "jedi" nil t)(setq jedi:setup-keys t);注意這句的位置要靠前(add-hook ‘python-mode-hook ‘jedi:setup)(setq jedi:complete-on-dot t)   ; optional
 三、使用

在 python 檔案中比如 import os 後,在 os 後面輸入焦點操作符 os. 這時就會彈出補全菜單,繼續輸入 os.path,把游標放在 path 上,輸入命令 M-x jedi:show-doc 或快速鍵:C-c d(這個快速鍵若要有效前提是設定檔裡要有 setq jedi:setup-keys t ),這樣就會在一個新的buffer裡顯示 os.path 的文檔了!

--End--

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.