Find file
Fetching contributors…
Cannot retrieve contributors at this time
195 lines (151 sloc) 4.1 KB
;;; init.el --- Sets up emacs environment
;;; Commentary:
;;; Code:
;; Custom commands
(defun copy-whole-buffer ()
"Copy entire buffer to clipboard."
(clipboard-kill-ring-save (point-min) (point-max)))
;; Bootstrap `use-package'
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . ""))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
;; Emacs configuration
(setq inhibit-startup-message t)
(setq initial-scratch-message ";; Take notes here. <SPACE> e will edit a new file\n\n")
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(setq ediff-split-window-function 'split-window-horizontally)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(tool-bar-mode -1)
(savehist-mode 1)
(use-package company
:ensure t)
(use-package eldoc
:ensure t)
(use-package flycheck
:ensure t
(use-package key-chord
:ensure t
(key-chord-mode 1)
(setq key-chord-two-keys-delay 0.2)
(setq key-chord-one-key-delay 0.3))
(use-package magit
:ensure t)
(use-package try
:ensure t)
(use-package which-key
:ensure t
;; Appearance
(use-package powerline
:ensure t
(use-package flycheck-color-mode-line
:ensure t
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
(use-package leuven-theme
:ensure t)
;; Evil mode
(use-package evil
:ensure t
(evil-mode 1)
(use-package evil-escape
:ensure t
(evil-escape-mode 1)
(setq-default evil-escape-key-sequence "fd")
(setq-default evil-escape-delay 0.2))
(use-package evil-leader
:ensure t
(evil-leader/set-leader "<SPC>")
"e" 'find-file
"bb" 'switch-to-buffer
"bd" 'kill-buffer-and-window
"by" 'copy-whole-buffer
"cy" 'clipboard-kill-ring-save
"cp" 'clipboard-yank
"fs" 'save-buffer
"gs" 'magit-status
"hs" 'split-window-horizontally
"iu" 'insert-char
"lf" 'load-file
"ne" 'flycheck-next-error
"pe" 'flycheck-previous-error
"rm" 'notmuch
"sm" 'message-send-and-exit
"si" 'whitespace-mode
"tn" 'linum-mode
"w1" 'delete-other-windows
"wk" 'windmove-left
"wj" 'windmove-right
"qq" 'save-buffers-kill-emacs
"zp" 'zeal-at-point
(use-package evil-surround
:ensure t
(use-package evil-indent-textobject
:ensure t))
;; Notmuch
(setq user-mail-address ""
user-full-name "Garry Cairns")
(setq smtpmail-smtp-server ""
smtpmail-smtp-service 25)
(setq send-mail-function 'smtpmail-send-it)
(setq notmuch-hello-sections '(notmuch-hello-insert-header notmuch-hello-insert-alltags))
(evil-add-hjkl-bindings notmuch-search-mode-map 'emacs)
(evil-add-hjkl-bindings notmuch-show-mode-map 'emacs)
(evil-set-initial-state 'notmuch-search-mode 'emacs)
(evil-set-initial-state 'notmuch-show-mode 'emacs)
;; Org mode
(use-package org-bullets
:ensure t
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
;; Programming and writing environments
(use-package elpy
:ensure t
(setq elpy-rpc-python-command "python3")
(setq elpy-rpc-backend "jedi")
(elpy-use-cpython "/usr/bin/python3")
(setq python-check-command "~/.local/bin/pyflakes")
(add-hook 'python-mode-hook (lambda () (show-paren-mode 1))))
(use-package haskell-mode
:ensure t)
(use-package intero
:ensure t
(add-hook 'haskell-mode-hook 'intero-mode))
(use-package markdown-mode
:ensure t)
(use-package yaml-mode
:ensure t)
;; Zeal setup
(use-package zeal-at-point
:ensure t)
(add-to-list 'zeal-at-point-mode-alist '(haskell-mode . "haskell"))
(add-to-list 'zeal-at-point-mode-alist '(python-mode . "python"))
(provide 'init)
;;; init.el ends here