Created
January 12, 2016 17:07
-
-
Save mopemope/07133c059b0a8266f5de to your computer and use it in GitHub Desktop.
emacs init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(add-to-list 'package-archives | |
'("gnu" . "http://elpa.gnu.org/packages/") t) | |
(package-initialize) | |
(unless (file-exists-p package-user-dir) | |
(package-refresh-contents)) | |
(defun install-packages (pkgs) | |
(dolist (p pkgs) | |
(when (not (package-installed-p p)) | |
(package-install p)))) | |
;; basic | |
(defvar basic-packages | |
'(ace-isearch | |
ace-jump-mode | |
anzu | |
ansible | |
atom-one-dark-theme | |
atom-dark-theme | |
aurora-theme | |
avy | |
color-theme | |
color-theme-sanityinc-tomorrow | |
company | |
company-ghc | |
company-ghci | |
company-web | |
cyberpunk-theme | |
dockerfile-mode | |
dracula-theme | |
erlang | |
ensime | |
fill-column-indicator | |
fish-mode | |
flycheck | |
fuzzy | |
ghc | |
groovy-mode | |
haskell-mode | |
helm | |
helm-ls-git | |
helm-ag | |
helm-swoop | |
helm-gtags | |
helm-company | |
lfe-mode | |
molokai-theme | |
seti-theme | |
sequential-command | |
magit | |
markdown-mode | |
nginx-mode | |
paradox | |
powerline | |
projectile | |
ssh | |
shell-pop | |
smartparens | |
smooth-scroll | |
terraform-mode | |
yaml-mode | |
yasnippet | |
w3m | |
web-mode | |
zeal-at-point)) | |
;; html, javascript | |
(defvar js-packages | |
'(js2-mode | |
emmet-mode | |
json-mode)) | |
;; php | |
(defvar php-packages | |
'(php-mode | |
php-extras)) | |
;; python | |
(defvar python-packages | |
'(python-mode | |
python-pep8 | |
python-pylint | |
virtualenv | |
tox)) | |
;; go | |
(defvar go-packages | |
'(go-mode | |
go-snippets | |
golint | |
company-go)) | |
;; java | |
(defvar java-packages | |
'(scala-mode2 | |
ensime)) | |
;; clojure | |
(defvar clojure-packages | |
'(ac-nrepl | |
clojure-mode | |
clojure-cheatsheet | |
clojure-snippets | |
cider | |
cider-decompile | |
clj-refactor | |
paredit | |
midje-mode | |
rainbow-delimiters)) | |
;; common lisp more | |
(defvar cl-packages | |
'(popwin | |
rainbow-delimiters | |
racket-mode | |
geiser)) | |
;; install packages | |
(install-packages basic-packages) | |
(install-packages python-packages) | |
(install-packages php-packages) | |
(install-packages go-packages) | |
(install-packages java-packages) | |
(install-packages js-packages) | |
(install-packages clojure-packages) | |
(install-packages cl-packages) | |
;; global settings | |
(setq debug-on-error t) | |
(defmacro lazyload (func lib &rest body) | |
`(when (locate-library ,lib) | |
,@(mapcar (lambda (f) `(autoload ',f ,lib nil t)) func) | |
(eval-after-load ,lib | |
'(progn | |
,@body)) t)) | |
(when (display-graphic-p) | |
(server-start) | |
(add-to-list 'default-frame-alist '(font . "Ricty 13")) | |
(set-face-attribute 'default nil :font "Ricty 13")) | |
(setq linum-format "%4d ") | |
(global-linum-mode t) | |
(set-language-environment "Japanese") | |
(prefer-coding-system 'utf-8) | |
(set-default-coding-systems 'utf-8) | |
(set-terminal-coding-system 'utf-8) | |
(setq recentf-max-saved-items nil) | |
(global-set-key (kbd "C-h") 'delete-backward-char) | |
;; load mozc | |
;; (load-file "~/.emacs.d/mozc.el") | |
;; (setq default-input-method "japanese-mozc") | |
(column-number-mode 1) | |
(cua-mode t) | |
(setq cua-enable-cua-keys nil) | |
(show-paren-mode t) | |
;; Tabの代わりにスペースでインデント | |
(setq-default fill-column 180) | |
(setq-default c-basic-offset 4 | |
tab-width 4 | |
indent-tabs-mode nil) | |
;;; シンボリックリンクの読み込みを許可 | |
(setq vc-follow-symlinks t) | |
;;; シンボリックリンク先のVCS内で更新が入った場合にバッファを自動更新 | |
(setq auto-revert-check-vc-info t) | |
;;; スタートアップスクリーンを表示しない | |
(setq inhibit-splash-screen t) | |
;;; iswitchb-mode | |
;;(setq iswitchb-mode t) | |
;;; バックアップファイルの設定 | |
(setq make-backup-files nil) | |
(setq auto-save-default nil) | |
(setq backup-directory-alist | |
`((".*" . ,temporary-file-directory))) | |
(setq auto-save-file-name-transforms | |
`((".*" ,temporary-file-directory t))) | |
(setq create-lockfiles nil) | |
;;リージョンに色をつける | |
(transient-mark-mode t) | |
;;リージョンを[delete][BS]で削除 | |
(delete-selection-mode t) | |
(setq redisplay-dont-pause t) | |
;; linum delay | |
(setq linum-delay t) | |
(defadvice linum-schedule (around my-linum-schedule () activate) | |
(run-with-idle-timer 0.2 nil #'linum-update-current)) | |
;; 全角スペース タブ trailing-spacesを目立たせる | |
(require 'whitespace) | |
;; space-markとtab-mark、それからspacesとtrailingを対象とする | |
(setq whitespace-style '(space-mark tab-mark face spaces trailing)) | |
(setq whitespace-display-mappings | |
'( | |
;; (space-mark ?\ [?\u00B7] [?.]) ; space - centered dot | |
(space-mark ?\xA0 [?\u00A4] [?_]) ; hard space - currency | |
(space-mark ?\x8A0 [?\x8A4] [?_]) ; hard space - currency | |
(space-mark ?\x920 [?\x924] [?_]) ; hard space - currency | |
(space-mark ?\xE20 [?\xE24] [?_]) ; hard space - currency | |
(space-mark ?\xF20 [?\xF24] [?_]) ; hard space - currency | |
(space-mark ?\u3000 [?\u25a1] [?_ ?_]) ; full-width-space - square | |
;; NEWLINE is displayed using the face `whitespace-newline' | |
;; (newline-mark ?\n [?$ ?\n]) ; eol - dollar sign | |
;; (newline-mark ?\n [?\u21B5 ?\n] [?$ ?\n]) ; eol - downwards arrow | |
;; (newline-mark ?\n [?\u00B6 ?\n] [?$ ?\n]) ; eol - pilcrow | |
;; (newline-mark ?\n [?\x8AF ?\n] [?$ ?\n]) ; eol - overscore | |
;; (newline-mark ?\n [?\x8AC ?\n] [?$ ?\n]) ; eol - negation | |
;; (newline-mark ?\n [?\x8B0 ?\n] [?$ ?\n]) ; eol - grade | |
;; | |
;; WARNING: the mapping below has a problem. | |
;; When a TAB occupies exactly one column, it will display the | |
;; character ?\xBB at that column followed by a TAB which goes to | |
;; the next TAB column. | |
;; If this is a problem for you, please, comment the line below. | |
(tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t]) ; tab - left quote mark | |
)) | |
;; whitespace-spaceの定義を全角スペースにし、色をつけて目立たせる | |
(setq whitespace-space-regexp "\\(\u3000+\\)") | |
(set-face-foreground 'whitespace-space "cyan") | |
(set-face-background 'whitespace-space 'nil) | |
;; whitespace-trailingを色つきアンダーラインで目立たせる | |
(set-face-underline 'whitespace-trailing t) | |
(set-face-foreground 'whitespace-trailing "cyan") | |
(set-face-background 'whitespace-trailing 'nil) | |
(global-whitespace-mode t) | |
;;;タイトルバーの表示 | |
(setq frame-title-format "%b") | |
(menu-bar-mode -1) | |
(tool-bar-mode 0) | |
;;;右端で折り返さない | |
(setq truncate-lines t) | |
(setq truncate-partial-width-windows nil) | |
;;;1行丸ごとカット | |
(setq kill-whole-line t) | |
(setq desktop-globals-to-save '(extended-command-history)) | |
(setq desktop-files-not-to-save "") | |
(desktop-save-mode 1) | |
(defun set-alpha (alpha-num) | |
"set frame parameter 'alpha" | |
(interactive "nAlpha: ") | |
(set-frame-parameter nil 'alpha (cons alpha-num '(100)))) | |
;; (when (display-graphic-p) | |
;; (set-alpha 0.90)) | |
;;; | |
;;; package settings | |
;;; | |
(when (display-graphic-p) | |
;; (require 'color-theme) | |
;; (require 'sanityinc-tomorrow-eighties-theme) | |
;; (require 'atom-one-dark-theme) | |
;; (require 'cyberpunk-theme) | |
;; (require 'aurora-theme) | |
(add-hook 'after-init-hook | |
'(lambda () | |
(require 'color-theme) | |
(require 'dracula-theme) | |
(set-alpha 0.9)))) | |
;;; | |
;;; yasnippet | |
;;; | |
(lazyload | |
(company-complete yas-minor-mode yas-global-mode) | |
"yasnippet") | |
;;; | |
;;; helm-mode | |
;;; | |
(lazyload | |
(helm-mode helm-config helm-mini helm-M-x helm-show-kill-ring helm-find-files helm-for-files) | |
"helm-config" | |
(require 'helm) | |
(require 'helm-config) | |
(require 'helm-ls-git) | |
(helm-mode 1) | |
(defvar helm-source-emacs-commands | |
(helm-build-sync-source "Emacs commands" | |
:candidates (lambda () | |
(let ((cmds)) | |
(mapatoms | |
(lambda (elt) (when (commandp elt) (push elt cmds)))) | |
cmds)) | |
:coerce #'intern-soft | |
:action #'command-execute) | |
"A simple helm source for Emacs commands.") | |
(defvar helm-source-emacs-commands-history | |
(helm-build-sync-source "Emacs commands history" | |
:candidates (lambda () | |
(let ((cmds)) | |
(dolist (elem extended-command-history) | |
(push (intern elem) cmds)) | |
cmds)) | |
:coerce #'intern-soft | |
:action #'command-execute) | |
"Emacs commands history") | |
(custom-set-variables | |
'(helm-truncate-lines t) | |
'(helm-delete-minibuffer-contents-from-point t) | |
'(helm-mini-default-sources '(helm-source-buffers-list | |
helm-source-files-in-current-dir | |
helm-source-ls-git | |
helm-source-bookmarks | |
helm-source-recentf | |
helm-source-emacs-commands-history | |
helm-source-emacs-commands))) | |
(define-key helm-command-map (kbd "M-/") 'helm-dabbrev) | |
(define-key helm-find-files-map (kbd "C-h") 'delete-backward-char) | |
(define-key helm-find-files-map (kbd "TAB") 'helm-execute-persistent-action) | |
(define-key helm-read-file-map (kbd "TAB") 'helm-execute-persistent-action)) | |
(define-key global-map (kbd "C-x C-f") 'helm-find-files) | |
(define-key global-map (kbd "C-x b") 'helm-for-files) | |
(define-key global-map (kbd "M-x") 'helm-M-x) | |
(define-key global-map (kbd "C-:") 'helm-mini) | |
(define-key global-map (kbd "M-y") 'helm-show-kill-ring) | |
;;; | |
;;; helm-swoop-mode | |
;;; | |
(lazyload | |
(helm-swoop helm-swoop-back-to-last-point helm-multi-swoop helm-multi-swoop-all) | |
"helm-swoop" | |
(setq helm-swoop-speed-or-color t) | |
(setq helm-swoop-split-direction 'split-window-vertically) | |
(setq helm-swoop-split-with-multiple-windows nil) | |
(setq helm-multi-swoop-edit-save t) | |
(define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)) | |
(global-set-key (kbd "M-i") 'helm-swoop) | |
(global-set-key (kbd "M-I") 'helm-swoop-back-to-last-point) | |
(global-set-key (kbd "C-c M-i") 'helm-multi-swoop) | |
(global-set-key (kbd "C-x M-i") 'helm-multi-swoop-all) | |
;; (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch) | |
(setq ispell-program-name "aspell") | |
;;; | |
;;; ace-isearch | |
;;; | |
(add-hook 'after-init-hook | |
'(lambda () | |
(global-ace-isearch-mode +1) | |
(custom-set-variables | |
'(ace-isearch-input-length 5) | |
'(ace-isearch-jump-delay 1.2) | |
'(ace-isearch-function 'avy-goto-char) | |
'(ace-isearch-use-jump 'printing-char)))) | |
;;; | |
;;; anzu | |
;;; | |
(lazyload | |
(anzu-mode anzu-query-replace anzu-query-replace-regexp) | |
"anzu" | |
(global-anzu-mode t) | |
(custom-set-variables | |
'(anzu-mode-lighter "") | |
'(anzu-search-threshold 1000) | |
'(anzu-replace-to-string-separator " => "))) | |
(global-set-key (kbd "M-%") 'anzu-query-replace) | |
(global-set-key (kbd "C-M-%") 'anzu-query-replace-regexp) | |
;;; | |
;;; company-mode | |
;;; | |
(lazyload | |
(global-company-mode company-mode company-init-backend) | |
"company" | |
(require 'company-go) | |
(require 'company-ghc) | |
(require 'company-web-html) | |
(setq company-idle-delay 0) | |
(setq company-minimum-prefix-length 2) | |
(setq company-selection-wrap-around t) | |
(setq company-dabbrev-downcase nil) | |
(setq company-go-insert-arguments nil) | |
(add-to-list 'company-backends 'company-semantic) | |
(add-to-list 'company-backends 'company-ghc) | |
(add-to-list 'company-backends 'company-go)) | |
(add-hook 'after-init-hook 'global-company-mode) | |
;;; | |
;;; flycheck-mode | |
;;; | |
(lazyload | |
(global-flycheck-mode flycheck-mode flycheck-previous-error flycheck-next-error) | |
"flycheck" | |
(setq-default flycheck-disabled-checkers | |
(append flycheck-disabled-checkers | |
'(javascript-jshint javascript-jscs))) | |
(flycheck-add-mode 'javascript-eslint 'web-mode) | |
(setq-default flycheck-disabled-checkers | |
(append flycheck-disabled-checkers | |
'(json-jsonlist)))) | |
(define-key global-map (kbd "M-p") 'flycheck-previous-error) | |
(define-key global-map (kbd "M-n") 'flycheck-next-error) | |
;;; | |
;;; shell-pop | |
;;; | |
(lazyload | |
(shell-pop) | |
"shell-pop" | |
(setq shell-pop-set-internal-mode "ansi-term") | |
(setq shell-pop-set-internal-mode-shell "/bin/fish") | |
(defvar ansi-term-after-hook nil) | |
(add-hook 'ansi-term-after-hook | |
(function | |
(lambda () | |
(define-key term-raw-map "\C-t" 'shell-pop)))) | |
(defadvice ansi-term (after ansi-term-after-advice (arg)) | |
"run hook as after advice" | |
(run-hooks 'ansi-term-after-hook)) | |
(ad-activate 'ansi-term)) | |
(global-set-key (kbd "C-t") 'shell-pop) | |
;;; | |
;;; popwin | |
;;; | |
(lazyload | |
(popwin-mode) | |
"popwin" | |
(popwin-mode 1) | |
(setq helm-samewindow nil) | |
(setq display-buffer-function 'popwin:display-buffer) | |
(setq popwin:special-display-config | |
'(("*Completions*" :noselect t :height 0.4) | |
("*tag" :noselect t :regexp t :height 0.4) | |
("helm" :regexp t :height 0.4)))) | |
(add-hook 'after-init-hook 'popwin-mode) | |
;;; | |
;;; rainbow-delimiters | |
;;; | |
(lazyload | |
(rainbow-delimiters-mode) | |
"rainbow-delimiters-mode" | |
(custom-set-faces | |
'(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) | |
'(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) | |
'(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) | |
'(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) | |
'(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) | |
'(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) | |
'(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) | |
'(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) | |
'(rainbow-delimiters-depth-9-face ((t (:foreground "#839496")))))) | |
;;; | |
;;; smartparens-mode | |
;;; | |
(lazyload | |
(smartparens-mode) | |
"smartparens-mode" | |
(require 'smartparens-config)) | |
;;; | |
;;; zeal-at-point | |
;;; | |
(global-set-key (kbd "C-c d") 'zeal-at-point) | |
;;; | |
;;; smooth-scroll | |
;;; | |
(add-hook 'after-init-hook | |
'(lambda () | |
(require 'smooth-scroll) | |
(smooth-scroll-mode t))) | |
;;; | |
;;; paradox | |
;;; | |
(lazyload | |
(paradox-list-packages paradox-enable) | |
"paradox" | |
(require 'paradox) | |
(setq paradox-github-token t)) | |
;;; | |
;;; jumplist | |
;;; | |
(lazyload | |
(jumplist-next jumplist-previous) | |
"jumplist" | |
(require 'helm-config) | |
(custom-set-variables | |
'(jumplist-hook-commands | |
'(helm-swoop helm-find-files helm-for-files isearch-forward isearch-backward end-of-buffer beginning-of-buffer)) | |
'(jumplist-ex-mode t))) | |
(global-set-key (kbd "C-<") 'jumplist-previous) | |
(global-set-key (kbd "C->") 'jumplist-next) | |
;;; | |
;;; powerline | |
;;; | |
(add-hook 'after-init-hook | |
'(lambda () | |
(require 'powerline) | |
(powerline-default-theme))) | |
;;; | |
;;; sequential-command | |
;;; | |
(add-hook 'after-init-hook | |
'(lambda () | |
(require 'sequential-command-config) | |
(sequential-command-setup-keys))) | |
;;; ------------------------------------------------------------------- | |
;;; lang mode settings | |
;;; ------------------------------------------------------------------- | |
;;; | |
;;; malabar-mode and java helpers | |
;;; | |
(defun completing-dot () | |
(interactive "*") | |
(insert ".") | |
(company-complete)) | |
(lazyload | |
(malabar-mode malabar-groovy malabar-groovy-start) | |
"malabar-mode" | |
(semantic-mode t) | |
(setq semantic-default-submodes | |
'(global-semantic-idle-completions-mode | |
global-semantic-idle-scheduler-mode | |
global-semanticdb-minor-mode | |
global-semantic-idle-summary-mode | |
global-semantic-highlight-func-mode | |
global-semantic-decoration-mode | |
global-semantic-mru-bookmark-mode)) | |
(setq semantic-idle-scheduler-idle-time 10) | |
(setq malabar-groovy-java-options '("-Duser.language=en")) | |
(setq malabar-import-excluded-classes-regexp-list | |
(append '("^java\\.awt\\..*$" | |
"^com\\.sun\\..*$" | |
"^org\\.omg\\..*$" | |
) malabar-import-excluded-classes-regexp-list)) | |
(define-key malabar-mode-map (kbd ".") 'completing-dot) | |
(define-key malabar-mode-map (kbd "C-x ?") 'malabar-show-javadoc) | |
(define-key malabar-mode-map (kbd "C-c C-v m") 'malabar-run-maven-command)) | |
(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode)) | |
(add-to-list 'auto-mode-alist '("\\.kt\\'" . malabar-mode)) | |
(add-hook 'malabar-mode-hook | |
(lambda () | |
(popwin-mode t) | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(setq company-backends '(company-semantic-completions-raw company-dabbrev company-gtags)) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
(add-hook 'after-save-hook 'malabar-compile-file-silently nil t))) | |
(defun my-java-ascii-to-native () | |
(interactive) | |
(let ((p (point))) | |
(when (and buffer-file-name | |
(string-ends-with buffer-file-name ".properties" )) | |
(erase-buffer) | |
(insert (shell-command-to-string (format "native2ascii -encoding UTF-8 -reverse '%s'" buffer-file-name))) | |
(goto-char p)))) | |
(defun my-java-native-to-ascii () | |
(interactive) | |
(let ((p (point))) | |
(when (and buffer-file-name | |
(string-ends-with buffer-file-name ".properties" )) | |
(erase-buffer) | |
(insert (shell-command-to-string (format "native2ascii -encoding UTF-8 '%s'" buffer-file-name))) | |
(goto-char p)))) | |
(defalias 'n2a 'my-java-native-to-ascii) | |
(defalias 'a2n 'my-java-ascii-to-native) | |
;;; | |
;;; web-mode | |
;;; | |
(lazyload | |
(web-mode) | |
"web-mode" | |
(setq web-mode-markup-indent-offset 2) | |
(setq web-mode-css-indent-offset 2) | |
(setq web-mode-code-indent-offset 2)) | |
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.vue\\'" . web-mode)) | |
(add-hook 'web-mode-hook | |
'(lambda() | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace))) | |
;;; | |
;;; js2-mode | |
;;; | |
(lazyload | |
(js2-mode) | |
"js2-mode" | |
(setq js2-basic-offset 2) | |
(font-lock-add-keywords | |
'js2-mode `(("\\(function\\) *(" | |
(0 (progn (compose-region (match-beginning 1) | |
(match-end 1) "\u03bb") | |
nil))))) | |
;; Use right arrow for return in one-line functions | |
(font-lock-add-keywords | |
'js2-mode `(("function *([^)]*) *{ *\\(return\\) " | |
(0 (progn (compose-region (match-beginning 1) | |
(match-end 1) "\u2190") | |
nil)))))) | |
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) | |
(add-hook 'js2-mode | |
'(lambda () | |
(popwin-mode t) | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(setq indent-tabs-mode nil) | |
(setq c-basic-offset 2) | |
(js2-mode-hide-warnings-and-errors) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace))) | |
;;; | |
;;; haskell-mode | |
;;; | |
(lazyload | |
(haskell-mode ghc-init ghc-debug) | |
"haskell-mode" | |
(require 'haskell-mode) | |
(require 'haskell-cabal) | |
(require 'ghc) | |
(ghc-init) | |
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload) | |
(define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring) | |
(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 C-c") 'haskell-process-cabal-build) | |
(define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear) | |
(define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal) | |
(define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)) | |
(defun turn-on-subword-mode () | |
(interactive) | |
(subword-mode 1)) | |
(add-to-list 'auto-mode-alist '("\\.hs$" . haskell-mode)) | |
(add-to-list 'interpreter-mode-alist '("runghc" . haskell-mode)) | |
(add-to-list 'interpreter-mode-alist '("runhaskell" . haskell-mode)) | |
(add-hook 'haskell-mode-hook | |
'(lambda() | |
(flycheck-mode t) | |
(setq tab-width 2) | |
(turn-on-haskell-indent) | |
(turn-on-subword-mode) | |
(turn-on-haskell-decl-scan) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace))) | |
;;; | |
;;; go-mode | |
;;; | |
(lazyload | |
(go-mode) | |
"go-mode" | |
(require 'golint) | |
(setq godef-command "godef") | |
(setq gofmt-command "goimports") | |
(define-key go-mode-map (kbd "M-.") 'godef-jump)) | |
(add-to-list 'auto-mode-alist '("\\.go$" . go-mode)) | |
(add-hook 'go-mode-hook | |
'(lambda() | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(add-hook 'before-save-hook 'gofmt-before-save))) | |
;;; | |
;;; lfe-mode | |
;;; | |
(lazyload | |
(lfe-mode) | |
"lfe-mode") | |
(add-to-list 'auto-mode-alist '("\\.lfe$" . lfe-mode)) | |
(add-hook 'lfe-mode-hook | |
(lambda () | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(rainbow-delimiters-mode t))) | |
;;; | |
;;; ensime-mode (Scala) | |
;;; | |
(lazyload | |
(ensime) | |
"ensime") | |
(lazyload | |
(scala-mode) | |
"scala-mode") | |
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook) | |
;;; | |
;;; sql-mode | |
;;; | |
(lazyload | |
(sql-mode) | |
"sql-mode") | |
(add-to-list 'auto-mode-alist '("\\.sql$" . sql-mode)) | |
(add-hook 'sql-mode | |
'(lambda () | |
(setq indent-tabs-mode nil) | |
(setq tab-width 2) | |
(setq c-basic-offset 2) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace))) | |
;;; | |
;;; emacs-lisp-mode | |
;;; | |
(lazyload | |
(emacs-lisp-mode) | |
"emacs-lisp-mode") | |
(add-hook 'emacs-lisp-mode-hook | |
'(lambda () | |
(smartparens-mode t) | |
(rainbow-delimiters-mode t) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace))) | |
;;; | |
;;; clojure-mode | |
;;; | |
(lazyload | |
(cljure-mode) | |
"clojure-mode") | |
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode)) | |
(add-to-list 'auto-mode-alist '("\\.cljs$" . clojure-mode)) | |
(add-hook 'clojure-mode-hook | |
'(lambda () | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(rainbow-delimiters-mode t) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace))) | |
;;; | |
;;; json-mode | |
;;; | |
(lazyload | |
(json-mode) | |
"json-mode") | |
(add-to-list 'auto-mode-alist '("\\.json$" . json-mode)) | |
(add-hook 'json-mode-hook | |
'(lambda () | |
(flycheck-mode t) | |
(smartparens-mode t) | |
(setq js-indent-level 2) | |
(setq json-reformat:indent-width 2) | |
(setq tab-width 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment