banner ad

Emacs setup for python

| February 1, 2013 | 0 Comments
0 Flares 0 Flares ×

Emacs is one of the best Python editors available. Today I set up my Python environment with Emacs.

1.YASnippet
YASnippet (Yet Another Snippet) is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates. Bundled language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML, CSS and more.

download:https://github.com/capitaomorte/yasnippet

install YASnippet for emacs:
cp top-folder-of-yasinppet to your emcas load-path
config:
(add-to-list’load-path “d:/tools/emacs-23.2/config/.emacs.d/capitaomorte-yasnippet-dad9612”)
(require ‘yasnippet)
(yas/initialize)
(yas/load-directory “d:/tools/emacs-23.2/config/.emacs.d/capitaomorte-yasnippet-dad9612/snippets”)
2.AutoComplete
download:http://cx4a.org/software/auto-complete/#Latest_Stable

install:
cp top-folder-of-autocomplete to your emcas load-path
config:
(add-to-list’load-path “d:/tools/emacs-23.2/config/.emacs.d/auto-complete-1.3.1”)
(require ‘auto-complete)
(require ‘auto-complete-config)
;(require ‘auto-complete-settings) ; for test here.
(global-auto-complete-mode t)
(add-to-list ‘ac-dictionary-directories “d:/tools/emacs-23.2/config/.emacs.d/auto-complete-1.3.1/dict”)
;(ac-config-default) ; for test here
(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)
(define-key ac-completing-map “\M-p” ‘ac-previous)
(setq ac-auto-start 1)
(setq ac-dwim t)
(define-key ac-mode-map (kbd “M-TAB”) ‘auto-complete)

3.pyflakes
sudo pip install pyflakes

4.Syntax highlighting
global-font-lock-mode 1

Download PDF
0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×

Tags: , ,

Category: Emacs

About the Author ()

My name is John Link.I am 26 years old. My major is Computer science and technology. I am a junior programmer with Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×