Skip to content

Instantly share code, notes, and snippets.

@azalea
Created December 3, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azalea/0f4d3fda4127a41ac6d6 to your computer and use it in GitHub Desktop.
Save azalea/0f4d3fda4127a41ac6d6 to your computer and use it in GitHub Desktop.
emacs init.el for Windows
;; Requisites: Emacs >= 24
;; INSTALL PACKAGES
;; --------------------------------------
(prefer-coding-system 'utf-8)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(defvar myPackages
'(better-defaults
ein
elpy
flycheck
py-autopep8
yasnippet
zenburn-theme
color-theme-sanityinc-tomorrow))
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
;; BASIC CUSTOMIZATION
;; --------------------------------------
(setq inhibit-startup-message t) ;; hide the startup message
(global-linum-mode t) ;; enable line numbers globally
(windmove-default-keybindings 'shift) ;; use shift to move around windows
(setq visible-bell nil) ;; Turn beep off
(global-hi-lock-mode t) ;; C-x w h REGEX to highlight, C-x w r to unhighlight
(set-default-font "DejaVu Sans Mono 12")
;; PYTHON CONFIGURATION
;; --------------------------------------
(elpy-enable)
(elpy-use-ipython)
;; use flycheck not flymake with elpy
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
;; enable autopep8 formatting on save
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
(require 'yasnippet)
; Source: http://www.emacswiki.org/emacs/CommentingCode
;; Original idea from
;; http://www.opensubscriber.com/message/emacs-devel@gnu.org/10971693.html
(defun comment-dwim-line (&optional arg)
"Replacement for the comment-dwim command.
If no region is selected and current line is not blank and we are not at the end of the line,
then comment current line.
Replaces default behaviour of comment-dwim, when it inserts comment at the end of the line."
(interactive "*P")
(comment-normalize-vars)
(if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))
(comment-dwim arg)))
(global-set-key "\M-;" 'comment-dwim-line)
(toggle-frame-fullscreen)
(global-set-key [f11] 'toggle-frame-fullscreen)
;; NSIS mode
;; -----------------------------------
(add-to-list 'load-path "~/.emacs.d/modes")
(autoload 'nsis-mode "nsis-mode" "NSIS mode" t)
(add-to-list 'auto-mode-alist '("\\.nsi\\'" . nsis-mode))
(add-to-list 'auto-mode-alist '("\\.nsh\\'" . nsis-mode))
(add-hook 'nsis-mode-hook
(lambda ()
(setq-default indent-tabs-mode nil)
(setq c-basic-indent 4)
(setq tab-width 4))
)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (sanityinc-tomorrow-eighties)))
'(custom-safe-themes
(quote
("628278136f88aa1a151bb2d6c8a86bf2b7631fbea5f0f76cba2a0079cd910f7d" default))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment