本文将介绍,在Emacs中,通过各种扩展,打造强大的Python IDE环境,包括Snippet工具,智能提示,自动补全,重构工具,调试以及GAE的调试,等等。以下各工具的安装前提是你对Emacs的配置文件有一定的了解,所有相关的el文件都必须放在load_path能够加载的地方。

1. YASnippet

snippet工具,可自定义一些模板,必不可少的好东西!看了下面这个很酷的演示动画就明白了:

http://yasnippet.googlecode.com/files/yasnippet.avi

安装方法:

(require 'yasnippet)
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")


2. AutoComplete

自动完成工具,会像VS里一样,弹出一个列表框让你去选择。

Emacs中打造强大的Python IDE'

安装方法:

(require 'auto-complete)
(require 
'auto-complete-config)
(global
-auto-complete-mode t)
(setq
-default ac-sources '(ac-source-words-in-same-mode-buffers))
(add-hook 
'emacs-lisp-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-symbols)))
(add
-hook 'auto-complete-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-filename)))
(set-face-background 
'ac-candidate-face "lightgray")
(set
-face-underline 'ac-candidate-face "darkgray")
(set-face-background 
'ac-selection-face "steelblue") ;;; 设置比上面截图中更好看的背景颜色
(define
-key ac-completing-map "\M-n" 'ac-next)  ;;; 列表中通过按M-n来向下移动
(define-key ac-completing-map "\M-p" 
'ac-previous)
(setq ac
-auto-start 2)
(setq ac
-dwim t)
(define
-key ac-mode-map (kbd "M-TAB"'auto-complete)

相关文章:

  • 2021-08-05
  • 2022-12-23
  • 2022-02-18
猜你喜欢
  • 2022-01-30
  • 2022-01-17
  • 2021-10-10
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2021-07-04
相关资源
相似解决方案