Skip to content

Instantly share code, notes, and snippets.

@mhlr

mhlr/init.el

Forked from lispnik/init.el
Created Feb 14, 2016
Embed
What would you like to do?
~/.emacs.d/init.el
(if window-system
(tool-bar-mode -1)
(menu-bar-mode -1))
(when (eq window-system 'ns)
(add-to-list 'default-frame-alist '(height . 80))
(add-to-list 'default-frame-alist '(width . 132)))
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(use-package ido
:config (progn
(setq ido-enable-prefix nil
ido-enable-flex-matching t
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-max-prospects 10
ido-default-file-method 'selected-window
ido-auto-merge-work-directories-length -1
ido-use-faces nil)
(ido-mode)))
(use-package xcscope
:ensure t
:config (progn
(cscope-setup)
(defun my-projectile-after-switch-project-hook ()
(setq cscope-initial-directory
(projectile-project-root)))
(add-hook 'projectile-after-switch-project-hook
'my-projectile-after-switch-project-hook)))
(use-package org :ensure t)
(use-package org-present
:ensure t
:config (progn
(add-hook 'org-present-mode-hook
(lambda ()
(org-present-big)
(org-display-inline-images)))
(add-hook 'org-present-mode-quit-hook
(lambda ()
(org-present-small)
(org-remove-inline-images)))))
(use-package ido-ubiquitous
:ensure t
:after ido
:config (ido-ubiquitous-mode))
(use-package flx-ido
:ensure t
:after ido
:config (flx-ido-mode))
(use-package ido-completing-read+
:ensure t)
(use-package smex
:ensure t
:config (progn
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)))
(use-package expand-region
:ensure t
:bind (("C-=" . er/expand-region)))
(use-package paredit
:ensure t
:config (add-hook 'prog-mode-hook 'enable-paredit-mode))
(use-package paren
:config (show-paren-mode))
(use-package prog-mode)
(use-package elisp-slime-nav
:ensure t
:config (add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode))
(use-package rainbow-mode
:ensure t
:config (add-hook 'prog-mode-hook 'rainbow-mode))
(use-package rainbow-delimiters
:ensure t
:config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
(use-package whitespace
:config
(progn
(add-hook 'prog-mode-hook 'whitespace-mode)
(add-hook 'before-save-hook 'whitespace-cleanup)
(setq whitespace-style '(face tabs empty trailing)
whitespace-line-column 100)))
(use-package aggressive-indent
:ensure t
:config
(progn
(add-hook 'emacs-lisp-mode-hook 'aggressive-indent-mode)
(add-hook 'clojure-mode-hook 'aggressive-indent-mode)
(add-hook 'lisp-mode-hook 'aggressive-indent-mode)))
(use-package slime
:ensure t
:config
(progn
(slime-setup '(slime-fancy slime-asdf slime-quicklisp))
(setq slime-fuzzy-completion-in-place t
slime-enable-evaluate-in-emacs t
slime-autodoc-use-multiline-p t
;; slime-complete-symbol-function 'slime-complete-symbol* ; 'slime-fuzzy-complete-symbol
slime-auto-start 'always)
(cond ((eq system-type 'windows-nt)
(setq slime-lisp-implementations
'((ccl ("wx86cl"))
(ccl64 ("wx86cl64"))
(sbcl ("sbcl")))
slime-default-lisp 'ccl64))
((eq system-type 'darwin)
(setq slime-lisp-implementations
'((ccl ("ccl"))
(sbcl ("sbcl") :coding-system utf-8-unix))
slime-default-lisp 'sbcl))
((eq system-type 'gnu/linux)
(setq slime-lisp-implementations
'((ccl ("lx86cl"))
(ccl64 ("lx86cl64"))
(sbcl ("sbcl") :coding-system utf-8-unix))
slime-default-lisp 'sbcl)))
(define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol)
(add-hook 'slime-repl-mode-hook 'paredit-mode)
;; http://www.emacswiki.org/emacs-test/ParEdit#toc3
(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)))
(use-package lisp-mode
:mode "\\(\\.sbclrc\\'\\|\\.cl\\'\\|\\.elcrc\\'\\)"
:config
(progn
(define-key emacs-lisp-mode-map (kbd "C-c C-c") 'eval-defun)
(define-key emacs-lisp-mode-map (kbd "C-c C-b") 'eval-buffer)))
(use-package eldoc
:diminish eldoc-mode
:config
(progn
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode)))
(use-package magit
:ensure t
:bind (("C-x g" . magit-status))
:config (setq magit-completing-read-function 'magit-ido-completing-read))
(use-package anzu
:ensure t
:config (global-anzu-mode)
:bind (("M-%" . anzu-query-replace)
("C-M-%" . anzu-query-replace-regexp)))
(use-package zop-to-char
:ensure t
:bind (("M-z" . zop-to-char)))
(use-package hippie-exp
:config (setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol)))
(use-package uniquify
:config (setq uniquify-buffer-name-style 'forward
uniquify-separator "/"
uniquify-after-kill-buffer-p t
uniquify-ignore-buffers-re "^\\*"))
(use-package delsel
:config (delete-selection-mode))
(use-package undo-tree
:ensure t
:config
(progn
(setq undo-tree-history-directory-alist `((".*" . ,temporary-file-directory))
undo-tree-auto-save-history t)
(global-undo-tree-mode)))
(use-package savehist
:config (setq savehist-additional-variables '(search-ring regexp-search-ring)
savehist-autosave-interval 60))
(use-package dired
:config (setq dired-recursive-deletes 'always
dired-recursive-copies 'always))
(use-package dired-x
:config
(progn
(setq dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$\\|^ntuser.*\\|NTUSER.*")
(add-hook 'dired-mode-hook 'dired-omit-mode)
(define-key dired-mode-map (kbd "M-o") 'dired-omit-mode))
:after dired)
(use-package diff-hl
:ensure t
:config
(progn
(global-diff-hl-mode)
(add-hook 'dired-mode-hook 'diff-hl-dired-mode))
:after dired)
(use-package ispell
:config
(setq ispell-program-name "aspell"
ispell-extra-args '("--sug-mode=ultra")))
(use-package recentf :config (recentf-mode))
(use-package gitignore-mode :ensure t)
(use-package gitconfig-mode :ensure t)
(use-package projectile
:ensure t
:config (projectile-global-mode))
(use-package ediff :config (setq ediff-window-setup-function 'ediff-setup-windows-plain))
(use-package saveplace :init (setq-default save-place t))
(use-package idle-highlight-mode
:ensure t
:config
(progn
(add-hook 'prog-mode-hook 'idle-highlight-mode)))
(use-package clojure-mode :ensure t)
(use-package clojure-mode-extra-font-locking :ensure t)
(use-package cider :ensure t)
(use-package clj-refactor
:ensure t
:config (add-hook 'clojure-mode-hook 'clj-refactor-mode))
(use-package smart-mode-line
:ensure t
:config
(progn
(setq sml/no-confirm-load-theme t
sml/theme nil)
(add-hook 'after-init-hook 'sml/setup)))
(use-package json-mode :ensure t)
(use-package js2-mode
:disabled t
:ensure t
:init
(setq-default js2-basic-offset 2
js2-bounce-indent-p nil
js-indent-level 2)
:config
(progn
(setq-default js2-mode-show-parse-errors nil
js2-mode-show-strict-warnings nil)
;; (js2-imenu-extras-setup)
;; (fset 'javascript-mode 'js2-mode)
))
(use-package yaml-mode :ensure t)
(use-package markdown-mode :ensure t)
(use-package adoc-mode
:mode "\\(\\.adoc\\'\\)"
:ensure t)
(use-package diminish
:ensure t
:config
(progn
(diminish 'undo-tree-mode)
(diminish 'anzu-mode)
(diminish 'whitespace-mode)
(diminish 'rainbow-mode)
(diminish 'elisp-slime-nav-mode)))
(use-package go-mode
:ensure t
:config (add-hook 'before-save-hook 'gofmt-before-save))
(use-package rust-mode :ensure t)
(use-package flycheck
:ensure t
:config (progn
(add-hook 'after-init-hook 'global-flycheck-mode)
(add-hook 'emacs-lisp-mode-hook
'(lambda ()
(when (and buffer-file-name
(string-match
"\\(init\\|custom\\)\\.el\\'"
(file-name-nondirectory buffer-file-name)))
(flycheck-mode -1))))))
(use-package j-mode :ensure t)
(use-package shampoo :ensure t)
(use-package web-mode
:ensure t
:mode "\\.html?\\'"
:config (progn
(setq web-mode-enable-auto-pairing t)))
(use-package scss-mode
:ensure t
:config (progn
(setq scss-compile-at-save nil)))
(use-package css-mode
:config (setq css-indent-offset 2))
(use-package css-eldoc
:ensure t
:config (add-hook 'css-mode-hook 'turn-on-css-eldoc))
(use-package dired-atool
:ensure t
:config (dired-atool-setup))
(use-package nasm-mode :ensure t)
(use-package minimal-light-theme
:ensure minimal-theme)
(global-set-key (kbd "C-x f")
'(lambda ()
"Find a recent file using ido."
(interactive)
(let ((file (ido-completing-read "Recent file: " (mapcar 'abbreviate-file-name recentf-list) nil t)))
(when file
(find-file file)))))
(setq-default indent-tabs-mode nil)
(setq-default tab-width 8)
(setq ns-command-modifier 'meta
ns-alternate-modifier 'super
ring-bell-function 'ignore
blink-matching-paren nil
require-final-newline t
tab-always-indent 'complete
ispell-program-name "aspell"
ispell-extra-args '("--sug-mode=ultra")
inhibit-startup-screen t
inhibit-startup-echo-area-message (user-login-name))
(fset 'yes-or-no-p 'y-or-n-p)
(global-unset-key (kbd "C-z"))
(setq custom-file "~/.emacs.d/custom.el")
;; (load custom-file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment