Skip to content

Instantly share code, notes, and snippets.

@bennofs
Created September 22, 2013 20:02
Show Gist options
  • Save bennofs/6663255 to your computer and use it in GitHub Desktop.
Save bennofs/6663255 to your computer and use it in GitHub Desktop.
emacs config
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; environment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'sticky-windows)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; modes and themes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(setq ido-create-new-buffer 'always)
(setq ido-file-extensions-order '(".hs" ".py" ".emacs" ".html" ".js" ".css" ".tpl" ".org"))
(setq ido-ignore-extensions t)
(setq qml-mode-indent-offet 2)
(setq TeX-PDF-mode t)
(setq-default yas-prompt-functions '(yas-ido-prompt yas-dropdown-prompt))
(cua-selection-mode 1)
(eval-after-load 'powerline '(powerline-default-theme))
(add-hook 'after-init-hook (lambda ()
(global-undo-tree-mode)
(ido-mode 1)
(yas-global-mode 1)
(load-theme 'assemblage)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; tabs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-generate-tab-stops (&optional width max)
"Return a sequence suitable for `tab-stop-list'."
(let* ((max-column (or max 200))
(tab-width (or width tab-width))
(count (/ max-column tab-width)))
(number-sequence tab-width (* tab-width count) tab-width)))
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq-default tab-stop-list (my-generate-tab-stops 2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; faces
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-face-attribute 'default nil :height 90)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; key bindings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun in-console (command)
"Run a command in a new window, at the bottom of the screen, dedicated and resized."
`(lambda ()
(interactive)
(let ((command-window (split-window-vertically)))
(select-window command-window)
(,command)
(window-resize command-window -13)
(set-window-dedicated-p command-window t))))
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x t") (in-console (function eshell)))
(global-set-key [(control x) (?0)] 'sticky-window-delete-window)
(global-set-key [(control x) (?1)] 'sticky-window-delete-other-windows)
(global-set-key [(control x) (?9)] 'sticky-window-keep-window-visible)
(defun toggle-local (var on off)
"Toggle a local variable, switching it between nil and t"
(make-variable-buffer-local var)
(set var (not (eval var)))
(if (eval var) on off))
(add-hook 'haskell-interactive-mode-hook (lambda ()
(local-set-key (kbd "C-c r") 'haskell-process-restart)
(local-set-key (kbd "C-c b") 'haskell-interactive-switch)))
(eval-after-load "haskell-mode"
'(progn
(define-key haskell-mode-map (kbd "C-c s") (lambda () (interactive) (message (toggle-local 'haskell-stylish-on-save "Stylish activated" "Stylish deactivated"))))
(define-key haskell-mode-map (kbd "C-c t") 'haskell-mode-tag-find) ;
(define-key haskell-mode-map (kbd "C-x C-d") nil)
(define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
(define-key haskell-mode-map (kbd "C-c b") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c r") 'haskell-process-restart)
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c i") 'haskell-navigate-imports)
(define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
(define-key haskell-mode-map (kbd "C-c h") 'hayoo)
(define-key haskell-mode-map (kbd "C-c M-.") nil)
(define-key haskell-mode-map (kbd "C-c C-d") nil)
(add-hook 'haskell-mode-hook (lambda () (add-hook 'before-save-hook 'haskell-mode-format-imports t t))))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; file major mode associations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.qml\\'" . qml-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CEDET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load-file "~/.emacs.d/plugins/cedet/cedet-devel-load.el")
(require 'semantic/bovine/c)
(require 'semantic/bovine/gcc)
(load-file "~/.emacs.d/projects.el")
(semantic-mode 1)
(global-ede-mode 1)
(defun my-cedet-hook ()
(local-set-key (kbd "C-M-i") 'semantic-ia-complete-symbol-menu)
(require 'auto-complete)
(require 'auto-complete-config)
(add-to-list 'ac-sources 'ac-source-semantic)
(auto-complete-mode 1)
)
(add-hook 'c-mode-common-hook 'my-cedet-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Flycheck checkers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-after-load 'flycheck
'(progn
(flycheck-define-checker
haskell-hdevtools-nolint
"A Haskell syntax and type checker using hdevtools.
See URL `https://github.com/bitc/hdevtools'."
:command ("hdevtools" "check" "-g" "-Wall" source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ":"
(or " " "\n ") "Warning:" (optional "\n")
(one-or-more " ")
(message (one-or-more not-newline)
(zero-or-more "\n"
(one-or-more " ")
(one-or-more not-newline)))
line-end)
(error line-start (file-name) ":" line ":" column ":"
(or (message (one-or-more not-newline))
(and "\n" (one-or-more " ")
(message (one-or-more not-newline)
(zero-or-more "\n"
(one-or-more " ")
(one-or-more not-newline)))))
line-end))
:modes haskell-mode
)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customize section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(ac-auto-show-menu t)
'(ac-auto-start 2)
'(ac-quick-help-delay 0.5)
'(ac-trigger-key "TAB")
'(ansi-color-faces-vector [default bold shadow italic underline bold bold-italic bold])
'(ansi-color-names-vector ["#081724" "#ff694d" "#68f6cb" "#fffe4e" "#bad6e2" "#afc0fd" "#d2f1ff" "#d3f9ee"])
'(ansi-term-color-vector [unspecified "#081724" "#ff694d" "#68f6cb" "#fffe4e" "#bad6e2" "#afc0fd" "#d2f1ff" "#d3f9ee"] t)
'(background-color "#002b36")
'(background-mode dark)
'(c-offsets-alist (quote ((case-label . +) (inclass . ++))))
'(column-number-mode t)
'(completion-ignored-extensions (quote (".o" "~" ".bin" ".lbin" ".so" ".a" ".ln" ".blg" ".bbl" ".elc" ".lof" ".glo" ".idx" ".lot" ".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/" ".fmt" ".tfm" ".class" ".fas" ".lib" ".mem" ".x86f" ".sparcf" ".dfsl" ".pfsl" ".d64fsl" ".p64fsl" ".lx64fsl" ".lx32fsl" ".dx64fsl" ".dx32fsl" ".fx64fsl" ".fx32fsl" ".sx64fsl" ".sx32fsl" ".wx64fsl" ".wx32fsl" ".fasl" ".ufsl" ".fsl" ".dxl" ".lo" ".la" ".gmo" ".mo" ".toc" ".aux" ".cp" ".fn" ".ky" ".pg" ".tp" ".vr" ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs" ".pyc" ".pyo" ".hi")))
'(cursor-color "#839496")
'(custom-safe-themes (quote ("77bd459212c0176bdf63c1904c4ba20fce015f730f0343776a1a14432de80990" "8f6537eb6f9d66b060c736f5f680f5c661e0a6b311b86defa293bc5ba104a030" "2b80b8864ae9fa004bf55bb6d30bb948621f85eb23ee80a1d7bf071d0e4b51e1" "f81e1ca8cefb9d4ded877d39f082c812294bcac41fce5be7230caa6cc83bde37" "3bd9497fb8f39c28ab58a9e957152ba2dc41223c23c5520ef10fc7bd6b222384" "a68fa33e66a883ce1a5698bc6ff355b445c87da1867fdb68b9a7325ee6ea3507" "88b663861db4767f7881e5ecff9bb46d65161a20e40585c8128e8bed8747dae5" "c1fb68aa00235766461c7e31ecfc759aa2dd905899ae6d95097061faeb72f9ee" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "7feeed063855b06836e0262f77f5c6d3f415159a98a9676d549bfeb6c49637c4" "04643edb183240f680d5465cf9e9ac3037086f701df09ce5d9183e6c69e73a7e" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "65510ff6bb3cddeb9fcdc61770abcb8cbf8a15185a0b268f77c6b515650a625b" "1177fe4645eb8db34ee151ce45518e47cc4595c3e72c55dc07df03ab353ad132" "3341f6db5ac17e4174f7488c40676e7f0464f1e88519a59303dc7e7774245bbf" "8874901e0011a7b07e546b65be1726c4cc3f35cf1a60f8805e6cb5bb59ba305c" "dc46381844ec8fcf9607a319aa6b442244d8c7a734a2625dac6a1f63e34bc4a6" "978bd4603630ecb1f01793af60beb52cb44734fc14b95c62e7b1a05f89b6c811" "d0ff5ea54497471567ed15eb7279c37aef3465713fb97a50d46d95fe11ab4739" "c7359bd375132044fe993562dfa736ae79efc620f68bab36bd686430c980df1c" "d293542c9d4be8a9e9ec8afd6938c7304ac3d0d39110344908706614ed5861c9" "6f3060ac8300275c990116794e1ba897b6a8af97c51a0cb226a98759752cddcf" "4aee8551b53a43a883cb0b7f3255d6859d766b6c5e14bcb01bed572fcbef4328" default)))
'(fci-rule-color "#073642")
'(flycheck-checkers (quote (bash c/c++-clang c/c++-cppcheck coffee coffee-coffeelint css-csslint d-dmd elixir emacs-lisp emacs-lisp-checkdoc erlang go-gofmt go-build go-test haml haskell-hdevtools-nolint haskell-hdevtools haskell-hlint html-tidy javascript-jshint json-jsonlint less lua perl php php-phpcs puppet-parser puppet-lint python-flake8 python-pylint rst ruby-rubocop ruby ruby-jruby rust sass scala scss sh-dash sh-bash tex-chktex tex-lacheck xml-xmlstarlet xml-xmllint zsh)))
'(flycheck-idle-change-delay 0.5)
'(foreground-color "#839496")
'(fringe-mode 5 nil (fringe))
'(global-linum-mode t)
'(global-undo-tree-mode t)
'(haskell-font-lock-symbols t)
'(haskell-indent-after-keywords (quote (("where" 2 0) ("of" 2) ("do" 2) ("mdo" 2) ("rec" 2) ("in" 2 0) ("{" 2) "if" "then" "else" "let")))
'(haskell-indent-dont-hang (quote ("(" "do" "{" "[")))
'(haskell-indent-offset 2)
'(haskell-indent-rhs-align-column 2)
'(haskell-indent-thenelse 0)
'(haskell-mode-hook (quote (turn-on-haskell-indentation (lambda nil (add-hook (quote before-save-hook) (quote haskell-mode-format-imports) t t)) turn-on-font-lock turn-on-eldoc-mode capitalized-words-mode turn-on-haskell-doc-mode flycheck-mode)))
'(haskell-process-args-cabal-repl (quote ("--ghc-option=-ferror-spans")))
'(haskell-process-auto-import-loaded-modules nil)
'(haskell-process-path-ghci "ghci")
'(haskell-process-use-presentation-mode nil)
'(haskell-program-name "ghci-7.8")
'(haskell-stylish-on-save nil)
'(haskell-tags-on-save t)
'(inhibit-startup-screen t)
'(js-indent-level 2)
'(linum-format " %2d ")
'(main-line-color1 "#222232")
'(main-line-color2 "#333343")
'(make-backup-files nil)
'(menu-bar-mode nil)
'(package-archives (quote (("gnu" . "http://elpa.gnu.org/packages/") ("marmelade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))))
'(powerline-buffer-size-suffix t)
'(powerline-color1 "#222232")
'(powerline-color2 "#333343")
'(powerline-default-separator (quote arrow-fade))
'(savehist-mode t)
'(scroll-bar-mode nil)
'(show-paren-mode t)
'(tab-width 2)
'(tool-bar-mode nil)
'(vc-annotate-background nil)
'(vc-annotate-color-map (quote ((20 . "#dc322f") (40 . "#cb4b16") (60 . "#b58900") (80 . "#859900") (100 . "#2aa198") (120 . "#268bd2") (140 . "#d33682") (160 . "#6c71c4") (180 . "#dc322f") (200 . "#cb4b16") (220 . "#b58900") (240 . "#859900") (260 . "#2aa198") (280 . "#268bd2") (300 . "#d33682") (320 . "#6c71c4") (340 . "#dc322f") (360 . "#cb4b16"))))
'(vc-annotate-very-old-color nil))
(put 'upcase-region 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)
(put 'set-goal-column 'disabled nil)
(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.
'(default ((t (:inherit fixed-pitch :stipple nil :background "#090F10" :foreground "#F0F0E0" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 105 :width normal :foundry "unknown" :family "Inconsolata"))))
'(linum ((t (:background "#09150F" :foreground "#434844" :height 90))))
'(powerline-active2 ((t (:inherit mode-line :background "gray12")))))
(put 'downcase-region 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment