308 lines
7.8 KiB
Org Mode
308 lines
7.8 KiB
Org Mode
#+Title: Pillow-Fort, an emacs config by Eli Mellen
|
|
#+Author: Eli Mellen
|
|
#+Date: 2019
|
|
|
|
* Fiddling with the basic UI and setting the stage
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(setq frame-title-format '("Cozy Pillow Fort")
|
|
ring-bell-function 'ignore
|
|
default-directory "~/")
|
|
|
|
(tool-bar-mode -1)
|
|
(menu-bar-mode +1) ; I <3 menu bar
|
|
(scroll-bar-mode -1)
|
|
(window-divider-mode 1) ; allows you to resize windows by grabbing the divider
|
|
(global-visual-line-mode 1) ; line wrapping, because I spend a lot of time working on very tiny screens
|
|
(global-prettify-symbols-mode 1)
|
|
(column-number-mode +1)
|
|
(global-hl-line-mode 1) ; highlight the currently active line
|
|
|
|
;; Display line numbers, but only on Emacs26 or higher
|
|
(when (version<= "26.0.50" emacs-version )
|
|
(global-display-line-numbers-mode))
|
|
|
|
;; Silkier scrolling
|
|
(setq scroll-margin 0
|
|
scroll-conservatively 10000
|
|
scroll-preserve-screen-position t
|
|
auto-window-vscroll nil)
|
|
|
|
;; Increase line space for better readability
|
|
(setq-default line-spacing 3)
|
|
|
|
;; Tabs are for monsters. No monsters are allowed in the pillow fort (defaults to 4 spaces).
|
|
(setq-default indent-tabs-mode nil
|
|
tab-width 4)
|
|
#+END_SRC
|
|
|
|
** Theme
|
|
I've been waffling a lot, lately, and also enjoying light themes.
|
|
#+BEGIN_SRC emacs-lisp
|
|
; (use-package dracula-theme
|
|
; :ensure t)
|
|
; (add-to-list 'default-frame-alist '(tty-color-mode . -1)) ; this makes it so that emacs doesn't load a theme when launched in a terminal
|
|
#+END_SRC
|
|
|
|
* Override some default behaviors for more convenient editing
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
;; Stop emacs from littering your file system with garbage
|
|
(setq create-lock-files nil make-backup-files nil auto-save-default nil)
|
|
|
|
;; Play nice(er) with the X11 clipboard
|
|
(setq select-enable-clipboard t)
|
|
|
|
;; Surpress the welcome screen
|
|
(setq inhibit-startup-message t initial-scratch-message nil)
|
|
|
|
;; Automatically save and load changes
|
|
(global-auto-revert-mode +1)
|
|
(auto-save-visited-mode +1)
|
|
|
|
;; Automatically insert buddies
|
|
(electric-pair-mode +1)
|
|
|
|
;; Highlight buddies (and do it right away)
|
|
(setq show-paren-delay 0)
|
|
(show-paren-mode 1)
|
|
#+END_SRC
|
|
|
|
* FedEx (because packages?)
|
|
** Helm, the completion framework
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package helm
|
|
:ensure t
|
|
:init
|
|
(setq helm-M-x-fuzzy-match t
|
|
helm-mode-fuzzy-match t
|
|
helm-buffers-fuzzy-matching t
|
|
helm-recentf-fuzzy-match t
|
|
helm-locate-fuzzy-match t
|
|
helm-semantic-fuzzy-match t
|
|
helm-imenu-fuzzy-match t
|
|
helm-completion-in-region-fuzzy-match t
|
|
helm-candidate-number-list 150
|
|
helm-split-window-in-side-p t
|
|
helm-move-to-line-cycle-in-source t
|
|
helm-echo-input-in-header-line t
|
|
helm-autoresize-max-height 0
|
|
helm-autoresize-min-height 20)
|
|
:config (helm-mode 1)
|
|
(global-set-key (kbd "M-x") 'helm-M-x) ; like spacemacs, but with M-x instead of SPC
|
|
(global-set-key (kbd "M-f") 'helm-find-files))
|
|
#+END_SRC
|
|
|
|
** Which Key, because things are easier with hints
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package which-key
|
|
:ensure t
|
|
:init
|
|
(setq which-key-separator " ")
|
|
(setq which-key-prefix-prefix "+")
|
|
:config (which-key-mode 1))
|
|
#+END_SRC
|
|
|
|
** Company, complettion in the mode-line
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package company
|
|
:ensure t
|
|
:init (setq company-dabbrev-downcase 0 company-idle-delay 0)
|
|
:config (progn (company-mode +1)
|
|
(global-company-mode +1)))
|
|
#+END_SRC
|
|
|
|
** Rainbows!
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package rainbow-delimiters
|
|
:ensure t
|
|
:config (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) ; on by default
|
|
(use-package rainbow-identifiers
|
|
:ensure t
|
|
:config (add-hook 'prog-mode-hook #'rainbow-identifiers-mode))
|
|
(use-package nyan-mode
|
|
:ensure t
|
|
:config (add-hook 'prog-mode-hook #'nyan-mode))
|
|
#+END_SRC
|
|
|
|
** Git gutter
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package git-gutter
|
|
:ensure t
|
|
:config (global-git-gutter-mode 't)
|
|
:diminish git-gutter-mode)
|
|
#+END_SRC
|
|
|
|
** Highlight TODO messages
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package hl-todo
|
|
:ensure t
|
|
:config (add-hook 'prog-mode-hook #'hl-todo-mode))
|
|
#+END_SRC
|
|
|
|
** Better undo-ing
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package undo-tree
|
|
:ensure t
|
|
:config (global-undo-tree-mode))
|
|
|
|
(use-package browse-kill-ring
|
|
:ensure t)
|
|
#+END_SRC
|
|
|
|
** Indent stuff for me
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package aggressive-indent
|
|
:ensure t)
|
|
#+END_SRC
|
|
|
|
** Flycheck (make sure the zipper is up?)
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package flycheck
|
|
:ensure t
|
|
:defer 2
|
|
:config (global-flycheck-mode)
|
|
(add-hook 'after-init-hook #'global-flycheck-mode))
|
|
#+END_SRC
|
|
|
|
** Automatically re-size splits
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package golden-ratio
|
|
:defer 2
|
|
:ensure t
|
|
:config (golden-ratio-mode 1))
|
|
#+END_SRC
|
|
|
|
** Language specific packages
|
|
*** Org related stuff
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package org
|
|
:mode (("\\.org$" . org-mode))
|
|
:ensure t
|
|
:config
|
|
(setq org-todo-keywords
|
|
'((sequence "TODO" "IN-PROCESS" "FOLLOW-UP" "|" "DONE"))))
|
|
|
|
(use-package org-bullets
|
|
:ensure t
|
|
:config
|
|
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
|
|
#+END_SRC
|
|
|
|
*** Restclient
|
|
Who needs Postman when you've got emacs!?
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package restclient
|
|
:ensure t)
|
|
(use-package ob-restclient
|
|
:ensure t
|
|
:init (org-babel-do-load-languages
|
|
'org-babel-load-languages
|
|
'((restclient . t))))
|
|
#+END_SRC
|
|
|
|
*** Clojure
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package clojure-mode
|
|
:ensure t)
|
|
|
|
(use-package
|
|
cider
|
|
:ensure t
|
|
:config (progn (add-hook 'cider-repl-mode-hook #'cider-company-enable-fuzzy-completion)
|
|
(add-hook 'cider-mode-hook #'cider-company-enable-fuzzy-completion)
|
|
(add-hook 'after-save-hook (lambda()
|
|
(when (eq major-mode 'clojure-mode)
|
|
(cider-load-buffer))))))
|
|
#+END_SRC
|
|
|
|
*** WISP
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package wispjs-mode
|
|
:ensure t
|
|
:mode "\\.wisp\\'")
|
|
#+END_SRC
|
|
|
|
*** Markdown
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package markdown-mode
|
|
:ensure t
|
|
:commands (markdown-mode gfm-mode)
|
|
:mode (("README\\.md\\'" . gfm-mode)
|
|
("\\.txt\\'" . markdown-mode)
|
|
("\\.md\\'" . markdown-mode)
|
|
("\\.markdown\\'" . markdown-mode))
|
|
:init (setq markdown-command "multimarkdown"))
|
|
#+END_SRC
|
|
|
|
*** Elisp
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package package-lint
|
|
:ensure t)
|
|
(use-package elisp-format
|
|
:ensure t)
|
|
#+END_SRC
|
|
|
|
*** HTML
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package web-mode
|
|
:ensure t)
|
|
#+END_SRC
|
|
|
|
*** JSON
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package json-mode
|
|
:ensure t
|
|
:mode "\\.json\\'")
|
|
#+END_SRC
|
|
|
|
*** Javascript
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package
|
|
js2-mode
|
|
:ensure t
|
|
:mode "\\.js\\'"
|
|
:interpreter "node"
|
|
:init (setq-default js2-concat-multiline-strings 'eol)
|
|
(setq-default js2-global-externs '("module" "require" "setTimeout" "clearTimeout" "setInterval"
|
|
"clearInterval" "location" "__dirname" "console" "JSON"
|
|
"window" "process" "fetch"))
|
|
(setq-default js2-strict-inconsistent-return-warning nil)
|
|
:config (use-package
|
|
prettier-js
|
|
:ensure t))
|
|
#+END_SRC
|
|
|
|
*** Typescript
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package tide
|
|
:ensure t
|
|
:mode "\\.ts\\'"
|
|
:after (typescript-mode company flycheck)
|
|
:hook ((typescript-mode . tide-setup)
|
|
(typescript-mode . tide-hl-identifier-mode)
|
|
(before-save . tide-format-before-save)))
|
|
#+END_SRC
|
|
|
|
* Useful functions
|
|
** Quickly edit this very file!
|
|
#+BEGIN_SRC emacs-lisp
|
|
(defun find-config ()
|
|
"Build the pillow fort!"
|
|
(interactive)
|
|
(find-file "~/.emacs.d/pillow-fort.org"))
|
|
#+END_SRC
|
|
|
|
** Create a new empty buffer
|
|
#+BEGIN_SRC emacs-lisp
|
|
;; Straight up stollen from <http://ergoemacs.org/emacs/emacs_new_empty_buffer.html>
|
|
(defun new-empty-buffer ()
|
|
"Create an empty buffer."
|
|
(interactive)
|
|
(let (($buf (generate-new-buffer "untitled")))
|
|
(switch-to-buffer $buf)
|
|
(funcall initial-major-mode)
|
|
(setq buffer-offer-save t)
|
|
$buf))
|
|
#+END_SRC
|