Instantly share code, notes, and snippets.

@lowks /.emacs
Last active Dec 23, 2015

Embed
What would you like to do?
(require 'package)
(dolist (source '(("marmalade" . "http://marmalade-repo.org/packages/")
;;("elpa" . "http://tromey.com/elpa/")
;; TODO: Maybe, use this after emacs24 is released
;; (development versions of packages)
("melpa" . "http://melpa.milkbox.net/packages/")
))
(add-to-list 'package-archives source t))
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar tmtxt/packages
'(python-mode pep8 pymacs flycheck))
(dolist (p tmtxt/packages)
(when (not (package-installed-p p))
(package-install p)))
(load-file "/home/lowks/.emacs.d/ergoemacs_release/site-lisp/site-start.el")
;;(ergoemacs-mode 1)
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
;;(setq py-install-directory "/home/lowks/.emacs.d/elpa/python-mode-6.0.10")
(load "~/.emacs.d/python.el")
;;(add-to-list 'load-path py-install-directory)
;;(require 'python-mode)
(setq py-smart-identation t)
(global-set-key (kbd "M-9") 'kill-whole-line)
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
;;(load-theme 'zenburn t
;; Linux/Windows style
(global-set-key (kbd "<home>") 'move-beginning-of-line)
(global-set-key (kbd "<end>") 'move-end-of-line)
;; make cursor movement keys under right hand's home-row.
(global-set-key (kbd "M-i") 'previous-line)
(global-set-key (kbd "M-j") 'backward-char)
(global-set-key (kbd "M-k") 'next-line)
(global-set-key (kbd "M-l") 'forward-char)
(global-set-key (kbd "M-u") 'backward-word)
(global-set-key (kbd "M-o") 'forward-word)
(global-set-key (kbd "M-m") 'back-to-indentation)
(global-set-key (kbd "M-6") 'ido-find-file)
(global-set-key (kbd "M-1") 'goto-line)
(global-set-key (kbd "M-+") 'yas/insert-snippet)
(ido-mode t)
(global-set-key (kbd "C-M-SPC") 'set-mark-command)
(require 'python)
(setq python-shell-interpreter "ipython")
(defun python-newline ()
(interactive)
(let ((char (car (inside-string?))))
(if char
(progn
(insert (format "%c \\" char))
(newline-and-indent)
(insert (format "%c" char)))
(newline))))
(add-hook
'python-mode-hook
(lambda()
;; ...
(define-key python-mode-map (kbd "RET") 'python-newline)))
(defun inside-string? ()
(interactive)
(let ((p (nth 8 (syntax-ppss))))
(memq (char-after p) '(?\" ?\'))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment