Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created March 4, 2015 22:09
Show Gist options
  • Save wfaler/48a2cc827a147e4e8e09 to your computer and use it in GitHub Desktop.
Save wfaler/48a2cc827a147e4e8e09 to your computer and use it in GitHub Desktop.
init.el
(require 'package)
(setq package-list '(markdown-mode
yaml-mode
js2-mode
find-file-in-project
auto-complete
ghc
nix-mode
dockerfile-mode
ensime
scala-mode2
haskell-mode
flycheck
flycheck-haskell
))
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;; activate all the packages (in particular autoloads)
(package-initialize)
;; fetch the list of packages available
(unless package-archive-contents
(package-refresh-contents))
;; install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
(when (not package-archive-contents)
(package-refresh-contents))
;; NO FRILLS
(dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
(when (fboundp mode) (funcall mode -1)))
(setq inhibit-startup-screen t)
;; NO JUNK
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
backup-directory-alist `((".*" . ,temporary-file-directory)))
;; HASKELL
(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(add-hook 'flycheck-mode-hook 'flycheck-haskell-setup)
(autoload 'ghc-init "ghc" nil t)
(defun el-get-ghc-mod-hook ()
(ghc-init)
(flycheck-mode))
(add-hook 'haskell-mode-hook 'el-get-ghc-mod-hook)
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(setq haskell-process-type 'cabal-repl
haskell-process-args-cabal-repl '("--ghc-option=-ferror-spans"))
(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 C-b") 'haskell-interactive-switch)
(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 M-.") nil)
(define-key haskell-mode-map (kbd "C-c C-d") nil)
(define-key haskell-mode-map (kbd "C-c v c") 'haskell-cabal-visit-file)
;; auto-complete
(ac-define-source haskell
'((candidates
. (lambda ()
(let ((resp (haskell-process-get-repl-completions (haskell-process) ac-prefix)))
(if (string= (car resp) "")
(cdr resp)
(mapcar (lambda (s) (car resp)) (cdr resp))))))))
(add-hook 'haskell-mode-hook '(lambda ()
(add-to-list 'ac-sources 'ac-source-haskell)))
;; END HASKELL
(require 'scala-mode2)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
(column-number-mode)
(setq-default indent-tabs-mode nil)
(define-key global-map (kbd "RET") 'newline-and-indent)
;;(load-theme 'solarized-dark t)
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
;;(add-to-list 'auto-mode-alist '("\\.purs$" . haskell-mode))
;;(custom-set-variables
;; '(js2-basic-offset 2)
;; '(js2-bounce-indent-p t)
;;)
;;(global-set-key (kbd "C-x f") 'find-file-in-project)
(set-face-attribute 'default nil :height 135)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment