2015-10-07 14:16:41 -04:00
|
|
|
;;; Emacs Config
|
|
|
|
;;;; indentation
|
2015-04-25 21:51:54 -04:00
|
|
|
(setq c-default-style "linux"
|
2015-08-16 21:32:07 -04:00
|
|
|
c-basic-offset 4
|
|
|
|
sgml-basic-offset 4)
|
2015-04-25 21:51:54 -04:00
|
|
|
(c-set-offset `inline-open 0)
|
|
|
|
(setq-default tab-width 4)
|
|
|
|
(add-hook 'sh-mode-hook (lambda () (setq tab-width 4)))
|
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; various options
|
2015-04-25 21:51:54 -04:00
|
|
|
(setq compilation-scroll-output 1
|
2015-08-16 21:32:07 -04:00
|
|
|
read-file-name-completion-ignore-case t
|
|
|
|
inhibit-startup-screen t
|
2015-10-04 16:01:32 -04:00
|
|
|
vc-follow-symlinks t
|
2015-10-10 12:52:26 -04:00
|
|
|
custom-file (expand-file-name "~/.emacs.d/custom.el")
|
2015-10-07 14:16:41 -04:00
|
|
|
gc-cons-threshold 100000000)
|
2015-05-03 09:45:48 -04:00
|
|
|
(load-theme 'fred t)
|
|
|
|
(savehist-mode 1)
|
2015-06-27 15:19:40 -04:00
|
|
|
(show-paren-mode 1)
|
2015-08-16 21:32:07 -04:00
|
|
|
(tool-bar-mode -1)
|
2015-04-25 21:51:54 -04:00
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; save backups and autosaves in tmp
|
2015-08-16 21:32:07 -04:00
|
|
|
(setq backup-directory-alist `((".*" . ,temporary-file-directory))
|
|
|
|
auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
|
2015-04-25 21:51:54 -04:00
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; keybinds
|
2015-08-16 21:32:07 -04:00
|
|
|
(global-set-key (kbd "C-z") `recompile)
|
|
|
|
(global-set-key (kbd "C-S-z") `compile)
|
2015-05-03 09:45:48 -04:00
|
|
|
(when (fboundp 'windmove-default-keybindings)
|
2015-08-16 21:32:07 -04:00
|
|
|
(windmove-default-keybindings))
|
2015-04-25 21:51:54 -04:00
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;; Packages
|
|
|
|
;;;; install/load quelpa
|
2015-08-16 21:32:07 -04:00
|
|
|
(package-initialize)
|
|
|
|
(unless (require 'quelpa nil t)
|
|
|
|
(with-temp-buffer
|
|
|
|
(url-insert-file-contents "https://raw.github.com/quelpa/quelpa/master/bootstrap.el")
|
|
|
|
(eval-buffer)))
|
2015-04-25 21:51:54 -04:00
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; install quelpa-use-package
|
2015-08-16 21:32:07 -04:00
|
|
|
(quelpa '(quelpa-use-package
|
|
|
|
:fetcher github
|
|
|
|
:repo "quelpa/quelpa-use-package"))
|
|
|
|
(require 'quelpa-use-package)
|
2015-04-25 21:51:54 -04:00
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; internal packages
|
2015-10-04 16:32:35 -04:00
|
|
|
(use-package ibuffer
|
|
|
|
:config
|
|
|
|
(global-set-key (kbd "C-x C-b") `ibuffer)
|
|
|
|
(setq ibuffer-saved-filter-groups
|
|
|
|
(quote (("default"
|
|
|
|
("emacs" (or
|
|
|
|
(name . "^\\*scratch\\*$")
|
|
|
|
(name . "^\\*Messages\\*$")))))))
|
|
|
|
(add-hook 'ibuffer-mode-hook (lambda ()
|
|
|
|
(ibuffer-auto-mode 1)
|
|
|
|
(setq ibuffer-show-empty-filter-groups nil))))
|
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; external packages (required)
|
2015-08-16 21:32:07 -04:00
|
|
|
(use-package company :quelpa
|
|
|
|
:config
|
|
|
|
(global-company-mode)
|
|
|
|
(setq company-idle-delay 0.1
|
|
|
|
company-dabbrev-downcase nil
|
|
|
|
company-dabbrev-ignore-case nil
|
|
|
|
company-clang-arguments (quote ("-I/usr/include" "-I/usr/arm-frc-linux-gnueabi/include/")))
|
|
|
|
(global-set-key (kbd "<C-tab>") 'company-manual-begin))
|
|
|
|
(use-package smart-mode-line :quelpa
|
|
|
|
:config
|
|
|
|
(setq sml/no-confirm-load-theme t)
|
|
|
|
(sml/setup)
|
|
|
|
(sml/apply-theme 'respectful)
|
|
|
|
(add-to-list 'sml/replacer-regexp-list '("^~/Programs/" ":Prog:") t)
|
|
|
|
(add-to-list 'sml/replacer-regexp-list '("^:Doc:Google Drive/" ":GDrive:") t)
|
|
|
|
(add-to-list 'sml/replacer-regexp-list '("^:GDrive:Dublin2014-2015/" ":Dublin:") t)
|
|
|
|
(setq rm-blacklist '(" company" " Undo-Tree")))
|
|
|
|
(use-package avy :quelpa
|
|
|
|
:config
|
|
|
|
(eval-after-load "isearch"
|
|
|
|
'(define-key isearch-mode-map (kbd "C-'") 'avy-isearch))
|
|
|
|
:bind ("C-;" . avy-goto-char)
|
|
|
|
:bind ("C-'" . avy-goto-char-2))
|
|
|
|
(use-package smex :quelpa
|
|
|
|
:bind ("M-x" . smex)
|
|
|
|
:bind ("M-X" . smex-major-mode-commands)
|
|
|
|
:config (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)) ;;normal M-x.
|
|
|
|
(use-package ace-window :quelpa
|
|
|
|
:bind ("M-p" . ace-window))
|
|
|
|
(use-package undo-tree :quelpa
|
|
|
|
:config
|
|
|
|
(global-undo-tree-mode)
|
2015-08-25 12:09:10 -04:00
|
|
|
(global-set-key (kbd "M-/") 'undo-tree-visualize))
|
2015-08-16 21:32:07 -04:00
|
|
|
(use-package hydra :quelpa
|
|
|
|
:config
|
|
|
|
;config is in separate file because it is really big
|
|
|
|
(load-file "~/.emacs.d/init-hydra.el"))
|
|
|
|
(use-package multiple-cursors :quelpa)
|
2015-09-28 19:18:26 -04:00
|
|
|
(use-package expand-region :quelpa
|
|
|
|
:bind ("C-=" . er/expand-region))
|
2015-08-19 20:28:19 -04:00
|
|
|
(use-package company-quickhelp :quelpa
|
|
|
|
:config
|
|
|
|
(company-quickhelp-mode 1)
|
|
|
|
(setq company-quickhelp-delay 0.5))
|
2015-08-16 21:32:07 -04:00
|
|
|
(use-package magit :quelpa
|
|
|
|
:bind ("C-x g" . magit-status))
|
2015-10-04 16:07:00 -04:00
|
|
|
(use-package popwin :quelpa
|
|
|
|
:config
|
|
|
|
(popwin-mode 1))
|
2015-10-05 18:22:21 -04:00
|
|
|
(use-package cat-mode :quelpa
|
|
|
|
(cat-mode :fetcher github :repo "ad1217/emacs-cat-mode")
|
|
|
|
:config
|
|
|
|
(cat-mode 1))
|
2015-10-07 15:09:37 -04:00
|
|
|
(use-package dired+ :quelpa
|
2015-10-10 12:53:33 -04:00
|
|
|
:init
|
|
|
|
(setq diredp-hide-details-initially-flag nil)
|
2015-10-07 15:09:37 -04:00
|
|
|
:config
|
2015-10-10 12:53:33 -04:00
|
|
|
(toggle-diredp-find-file-reuse-dir 1))
|
2015-10-10 12:55:14 -04:00
|
|
|
(use-package outline-magic :quelpa
|
|
|
|
:config
|
|
|
|
(define-key outline-minor-mode-map (kbd "M-<tab>") 'outline-cycle))
|
2015-05-03 09:45:48 -04:00
|
|
|
|
2015-10-07 14:16:41 -04:00
|
|
|
;;;; optional external packages
|
2015-08-16 21:32:07 -04:00
|
|
|
(use-package arduino-mode
|
|
|
|
:mode "\\.pde\\'"
|
|
|
|
:mode "\\.ino\\'")
|
|
|
|
(use-package company-jedi
|
|
|
|
:config
|
|
|
|
(add-hook 'python-mode-hook (lambda() (add-to-list 'company-backends 'company-jedi))))
|
|
|
|
(use-package csharp-mode)
|
|
|
|
(use-package gnuplot-mode
|
|
|
|
:mode ("\\.gp$" . gnuplot-mode))
|
|
|
|
(use-package lua-mode)
|
|
|
|
(use-package markdown-mode
|
|
|
|
:config
|
2015-08-30 18:33:43 -04:00
|
|
|
(setq markdown-command "markdown_py -x markdown.extensions.wikilinks -x markdown.extensions.smarty -x markdown.extensions.extra -x latex -x markdown.extensions.sane_lists -x markdown.extensions.toc -x markdown_checklist.extension -c ~/.emacs.d/markdownConfig.yml"
|
2015-08-16 21:32:07 -04:00
|
|
|
markdown-enable-math t)
|
|
|
|
(local-set-key (kbd "<tab>") 'markdown-demote)
|
|
|
|
(local-set-key (kbd "S-<tab>") 'markdown-promote)
|
|
|
|
:mode "\\.md\\'")
|
|
|
|
(use-package php-mode)
|
|
|
|
(use-package pkgbuild-mode)
|
|
|
|
(use-package qml-mode)
|
2015-08-25 12:04:23 -04:00
|
|
|
(use-package scad-mode
|
|
|
|
:mode "\\.scad$")
|
2015-10-10 13:59:54 -04:00
|
|
|
(use-package smart-tabs-mode
|
2015-08-16 21:32:07 -04:00
|
|
|
:config
|
|
|
|
(smart-tabs-insinuate 'c 'c++ 'javascript))
|
|
|
|
(use-package todotxt-mode
|
|
|
|
:config
|
2015-10-11 22:16:11 -04:00
|
|
|
(setq todotxt-default-file (expand-file-name "~/Sync/todo/todo.txt")
|
|
|
|
todotxt-default-archive-file (expand-file-name "~/Sync/todo/done.txt")
|
|
|
|
todotxt-due-tag "due"
|
|
|
|
todotxt-mode-keywords
|
|
|
|
'(("^x .*$" 0 '(:foreground "gray80" :strike-through t))
|
|
|
|
("^(A) " 0 '(:foreground "red"))
|
|
|
|
("^(B) " 0 '(:foreground "orange"))
|
|
|
|
("^(C) " 0 '(:foreground "teal"))
|
|
|
|
("^(D) " 0 '(:foreground "light green"))
|
|
|
|
("^(Y) " 0 '(:foreground "light grey"))
|
|
|
|
("([A-Z]+)" . font-lock-builtin-face)
|
|
|
|
("\\([a-zA-Z0-9_-]+\\):\\([a-zA-Z0-9._-]+\\)" . font-lock-variable-name-face)
|
|
|
|
("+\\w+" . font-lock-function-name-face)
|
|
|
|
("@\\w+" . font-lock-type-face)
|
|
|
|
("#important" 0 '(:foreground "orange red")) ; special tag
|
|
|
|
("#waiting" 0 '(:foreground "dark orange")) ; special tag
|
|
|
|
("#\\w+" . font-lock-comment-face)
|
|
|
|
("-\\([a-zA-Z_-]+\\)" . font-lock-variable-name-face)
|
|
|
|
("^[0-9]+-[0-9]+-[0-9]+" 0 '(:foreground "gray90")))))
|
2015-10-10 14:16:56 -04:00
|
|
|
(use-package latex
|
2015-08-29 13:43:41 -04:00
|
|
|
:config
|
2015-09-18 11:23:42 -04:00
|
|
|
(setq TeX-command-extra-options "-shell-escape")
|
2015-10-10 14:17:46 -04:00
|
|
|
(define-key LaTeX-mode-map (kbd "C-z")
|
|
|
|
'(lambda () (interactive)
|
|
|
|
(save-buffer)
|
|
|
|
(TeX-command "LaTeX" 'TeX-master-file -1)))
|
|
|
|
(define-key LaTeX-mode-map (kbd "C-c e") 'tex-close-latex-block)
|
|
|
|
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
|
2015-10-04 16:09:42 -04:00
|
|
|
(defun latex-tsv-to-table ()
|
|
|
|
"Converts tab-seperated-values to a LaTeX table."
|
|
|
|
(interactive)
|
2015-10-05 18:26:06 -04:00
|
|
|
(let ((beg (region-beginning)) (end-line (line-number-at-pos (region-end))))
|
2015-10-04 16:09:42 -04:00
|
|
|
(save-excursion
|
2015-10-05 18:26:06 -04:00
|
|
|
(goto-line end-line)
|
|
|
|
(indent-region beg (point-at-eol))
|
|
|
|
(replace-regexp "\t" " & " nil beg (point-at-eol))
|
|
|
|
(replace-regexp "$" " \\\\\\\\" nil beg (point-at-eol))
|
2015-10-04 16:23:43 -04:00
|
|
|
(align beg (point))))))
|
2015-09-28 19:21:04 -04:00
|
|
|
(use-package fasd
|
|
|
|
:config
|
|
|
|
(global-set-key (kbd "C-x C-S-f") 'fasd-find-file)
|
|
|
|
(global-fasd-mode 1)
|
|
|
|
(setq fasd-enable-initial-prompt nil))
|
2015-09-17 12:52:19 -04:00
|
|
|
(use-package yasnippet
|
|
|
|
:config
|
|
|
|
(defun company-to-yasnippet ()
|
|
|
|
(interactive)
|
|
|
|
(company-abort)
|
|
|
|
(call-interactively 'company-yasnippet))
|
|
|
|
(bind-key "<backtab>" 'company-to-yasnippet company-active-map)
|
|
|
|
(bind-key "<backtab>" 'company-yasnippet))
|
2015-10-07 15:07:33 -04:00
|
|
|
|
|
|
|
;;; Local Variables
|
2015-10-10 14:23:44 -04:00
|
|
|
(add-to-list 'safe-local-eval-forms '(outline-hide-body))
|
2015-10-07 15:07:33 -04:00
|
|
|
;; Local Variables:
|
|
|
|
;; eval: (outline-minor-mode)
|
|
|
|
;; eval: (outline-hide-body)
|
|
|
|
;; End:
|