Spacemacs下配置python自动补全
0.在开始前先装好pip和virtualenv
1. 安装:epc deferred uto-complete jedi,安装方法:
在文件 ~/.spacemacs中,找到dotspacemacs-additional-package,并将上面四个packages 写进后面的括号,packages间以空格隔开,示例代码如下:
;; List of additional packages that will be installed without being;; wrapped in a layer. If you need some configuration for these;; packages, then consider creating a layer. You can also put the;; configuration in `dotspacemacs/user-config'.
dotspacemacs-additional-packages '(youdao-dictionary)
2. 在emacs中安装install-server,安装方法如下:
M-X: Jedi:install-server
3.添加以下配置到emacs的配置文件(.emacs.d/init.el)里
(autoload 'jedi:setup "jedi" nil t)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:setup-keys t) ; optional
(setq jedi:complete-on-dot t) ; optional
这样就大功告成了,可以开始使用了
注:
删除安装的 package
只需要将需要删除的 package 名称加入到dotspacemacs-excluded-packages变量中, 在下一次启动 emacs 时即会删除该 package. 示例代码如下:
;; A list of packages and/or extensions that will not be install and loaded.
dotspacemacs-excluded-packages '(vi-tilde-fringe)
安装 package
在 Spacemacs 中安装 package 时最好不要使用package-install, 因为这样安装的 package 会在下一次启动时被删除.
Spacemacs 提供了一个方式, 你只需将需要安装的 package 加入到dotspacemacs-additional-package变量中即可, 示例代码如下:
;; List of additional packages that will be installed without being;; wrapped in a layer. If you need some configuration for these;; packages, then consider creating a layer. You can also put the;; configuration in `dotspacemacs/user-config'.
dotspacemacs-additional-packages '(youdao-dictionary)
参考:
[1] https://github.com/emacs-china/Spacemacs-rocks
[2] http://www.xuebuyuan.com/1929257.html