2019-02-10 14:09:23 -05:00
* Packaging
** Package.el
[[http://wikemacs.org/wiki/Package.el ][Package.el ]] is the built-in package manager in Emacs. This is where the fun begins.
#+BEGIN_SRC emacs-lisp
(require 'package)
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/ ")
("melpa" . "https://melpa.org/packages/ ")
("melpa-stable" . "https://stable.melpa.org/packages/ ")
("marmalade" . "https://marmalade-repo.org/packages/ ")
("org" . "https://orgmode.org/elpa/ ")))
(setq package-enable-at-startup nil)
(package-initialize)
#+END_SRC
** use-package
[[https://github.com/jwiegley/use-package ][use-package ]] is a nifty macro that interfaces with =Package.el= , keeping package-specific
configuration all in once place. It's pretty much the basis of this entire config.
#+BEGIN_SRC emacs-lisp
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
2018-10-15 18:28:02 -04:00
2019-02-10 14:09:23 -05:00
(eval-when-compile
(require 'use-package))
2018-10-15 18:28:02 -04:00
2019-02-10 14:09:23 -05:00
(setq use-package-compute-statistics t)
(setq use-package-always-ensure t)
(setq use-package-always-pin "melpa")
(setq use-package-verbose t)
#+END_SRC
*** Custom Keywords
A few useful =:keyword= macros that extend the vanilla =use-package= functionality.
**** :company
#+BEGIN_SRC emacs-lisp
(require 'derived)
(defun use-package-company-normalize (name keyword args)
"Normalize the KEYWORD with NAME :company with arguments ARGS into a list of pairs for the handler."
(use-package-as-one (symbol-name keyword) args
(lambda (label arg)
(unless (or (consp arg) (use-package-non-nil-symbolp arg))
(use-package-error
(concat
label
"<symbol > or "
"(<symbol or list of symbols > . <symbol or function >) or "
"a list of these")))
(use-package-normalize-pairs
(lambda (k)
(or (use-package-non-nil-symbolp k)
(and (consp k)
(not (cdr (last k)))
(seq-every-p 'use-package-non-nil-symbolp k))))
#'use-package-recognize-function
name label arg))))
;;;###autoload
(defun use-package-company-handler (name _keyword args rest state)
"Generate a function and hook from each pair in NAME ARGS for the keyword with NAME :company, appending the forms to the ‘ use-package’ declaration specified by REST and STATE."
(use-package-concat
(use-package-process-keywords name rest state)
(mapcan
(lambda (def)
(let ((modes (car def))
(backend (cdr def))
(fun (intern (concat "use-package-company-add-" (symbol-name (cdr def))))))
(when backend
(append
`((defun ,fun ()
(setq-local company-backends
(append company-backends '(,backend)))))
(mapcar
(lambda (mode)
`(add-hook
',(derived-mode-hook-name mode)
#',fun))
(if (use-package-non-nil-symbolp modes) (list modes) modes))))))
(use-package-normalize-commands args))))
(defalias 'use-package-normalize/:company 'use-package-company-normalize)
(defalias 'use-package-handler/:company 'use-package-company-handler)
(defalias 'use-package-autoloads/:company 'use-package-autoloads-mode)
2018-10-15 18:28:02 -04:00
2019-02-10 14:09:23 -05:00
(setq use-package-keywords
(let ((idx (+ 1 (cl-position :hook use-package-keywords))))
(append
(seq-subseq use-package-keywords 0 idx)
(list :company)
(nthcdr idx use-package-keywords))))
#+END_SRC
* Keybinds
** which-key
[[https://github.com/justbur/emacs-which-key ][which-key ]] displays a popup in the minibuffer that shows
keybindings following incomplete commands.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package which-key
:diminish
:config
(which-key-mode))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** General
[[https://github.com/noctuid/general.el ][General ]] is an excellent keybind manager that adds *tons* of useful macros.
Also set up a leader key and prefixes, like =\= in Vim.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package general
:config
(general-create-definer jf-leader-def
:keymaps 'override
:states '(normal insert emacs)
:prefix "SPC"
:non-normal-prefix "M-SPC")
(defun jf-create-wk-prefix (desc)
"Helper for creating which-key prefix descriptions.
Bind to a key with general to make which-key show DESC
as the prefix's description"
`(:ignore t :wk ,desc))
(defmacro jf-create-definers (definitions)
"A wrapper for general-create-definer.
For every pair in DEFINITIONS, creates a leader
with name jf-NAME-def and keybind SPC KEY or M-SPC KEY in normal mode."
`(progn
,@(mapcan
(lambda (def)
(let ((key (car def))
(name (cdr def)))
`((general-create-definer ,(intern (concat "jf-" name "-def"))
:keymaps 'override
:states '(normal insert emacs)
:prefix ,(concat "SPC " key)
:non-normal-prefix ,(concat "M-SPC " key))
(jf-leader-def ,key ',(jf-create-wk-prefix name)))))
definitions)))
(jf-create-definers
(("a" . "apps")
("b" . "buffers")
("f" . "files")
("g" . "git")
("h" . "help")
("m" . "major")
("o" . "org")
("p" . "projects")
("w" . "windows"))))
#+END_SRC
2019-05-03 08:58:16 -04:00
** Macros
A helper for defining procedural keyboard macros
#+BEGIN_SRC emacs-lisp
(defun jf-replace-regexps-in-string (str regexps)
"Replace all pairs of (regex . replacement) defined by REGEXPS in STR."
(if (null regexps)
str
(jf-replace-regexps-in-string
(replace-regexp-in-string (caar regexps) (cdar regexps) str t)
(cdr regexps))))
(defun jf-kbd (str)
"Convert STR into a keyboard macro string by replacing terminal key sequences with GUI keycodes."
(let ((jf-kbd-regex '(("ESC" . "<escape >")
("DEL" . "<delete >")
("BS" . "<backspace >")
("RET" . "<return >")
("SPC" . "<SPC >")
("TAB" . "<tab >"))))
(jf-replace-regexps-in-string str jf-kbd-regex)))
(defun jf-kbd-exec (str)
"Execute the key sequence defined by STR. Terminal based keys are expanded to their graphical counterparts."
(let ((minibuffer-message-timeout 0))
(execute-kbd-macro (read-kbd-macro (jf-kbd str)))))
(defmacro jf-kbd-defmacro (name &rest forms)
"Create an interactive function NAME with body FORMS, where the evaluation of each form is executed as a keyboard macro."
`(defun ,name ()
(interactive)
,@(mapcan (lambda (form) `((jf-kbd-exec ,form))) forms)))
#+END_SRC
2019-02-10 14:09:23 -05:00
* Vim Emulation
** Evil
[[https://github.com/emacs-evil/evil ][Evil ]] is pretty much the entirety of Vim in Emacs.
#+BEGIN_SRC emacs-lisp
(use-package evil
:diminish undo-tree-mode
2018-10-16 22:02:11 -04:00
2019-02-10 14:49:18 -05:00
:preface
2019-02-10 14:09:23 -05:00
(defun jf-window-split ()
(interactive)
(evil-window-split)
(evil-window-down 1))
(defun jf-window-vsplit ()
(interactive)
(evil-window-vsplit)
(evil-window-right 1))
2018-10-16 22:02:11 -04:00
2019-02-10 14:09:23 -05:00
:config
(evil-mode t)
2018-10-15 18:28:02 -04:00
2019-02-10 14:09:23 -05:00
(jf-windows-def
"-" #'jf-window-split
"=" #'jf-window-vsplit
"b" #'balance-windows
"H" #'evil-window-far-left
"J" #'evil-window-bottom
"K" #'evil-window-top
"L" #'evil-window-far-right
"h" #'evil-window-left
"j" #'evil-window-right
"k" #'evil-window-down
"l" #'evil-window-right
2019-02-10 14:49:18 -05:00
"o" #'other-frame)
:custom
(evil-want-integration t)
(evil-want-keybinding nil)
(evil-want-fine-undo t))
2019-02-10 14:09:23 -05:00
#+END_SRC
** Evil Collection
[[https://github.com/emacs-evil/evil-collection ][Evil Collection ]] adds Evil bindings for all the parts of Emacs that Evil
doesn't cover properly by default.
#+BEGIN_SRC emacs-lisp
(use-package evil-collection
:after evil
:config
(evil-collection-init
'(calendar
cmake-mode
company
2019-04-25 18:31:50 -04:00
compile
2019-02-10 14:09:23 -05:00
custom
debug
dired
doc-view
elisp-mode
elisp-refs
eshell
eval-sexp-fu
flycheck
flymake
grep
help
ibuffer
image
image-dired
info
ivy
js2-mode
log-view
man
neotree
python
racer
realgud
which-key)))
#+END_SRC
** Evil Extensions
*** Avy
An enhanced version of =f= in Vim.
#+BEGIN_SRC emacs-lisp
(use-package avy
:general
(:keymaps 'override
:states 'normal
"C-f" 'avy-goto-char-in-line
"C-F" 'avy-goto-char))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:57:08 -05:00
*** Subword
Make boundaries between words in camelCase act as separate words for evil motions.
#+BEGIN_SRC emacs-lisp
(use-package subword
:init
(define-category ?U "Uppercase")
(define-category ?u "Lowercase")
(modify-category-entry (cons ?A ?Z) ?U)
(modify-category-entry (cons ?a ?z) ?u)
:config
(push '(?u . ?U) evil-cjk-word-separating-categories))
#+END_SRC
2019-02-10 14:09:23 -05:00
*** evil-surround
Use =S= and a delimiter to surround in visual mode.
2018-10-18 10:29:46 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package evil-surround
:after evil
:diminish
:config
(global-evil-surround-mode 1))
2018-10-18 10:29:46 -04:00
#+END_SRC
2019-04-25 18:24:46 -04:00
*** evil-goggles
Visual highlighting on evil motions
#+BEGIN_SRC emacs-lisp
(use-package evil-goggles
:config
(evil-goggles-mode))
#+END_SRC
2019-02-10 14:09:23 -05:00
* Emacs
** Defaults
*** Configuration Editing
Add functions for editing and reloading the Emacs config files.
2018-12-08 16:19:55 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(defun jf-edit-config ()
2018-12-08 16:19:55 -05:00
(interactive)
2019-02-10 14:09:23 -05:00
(find-file jf-config-file))
2018-12-08 16:19:55 -05:00
2019-02-10 14:09:23 -05:00
(defun jf-edit-init ()
(interactive)
(find-file jf-init-file))
2018-12-08 16:19:55 -05:00
2019-02-10 14:09:23 -05:00
(defun jf-reload-config ()
(interactive)
(org-babel-load-file jf-config-file))
(jf-files-def
"e" (jf-create-wk-prefix "emacs files")
"ec" #'jf-edit-config
"ei" #'jf-edit-init
"er" #'jf-reload-config)
#+END_SRC
*** Add to Load Path
Create and add a folder to the load path for local lisp files.
The folder itself and all descendants will be added to the path.
These packages will take precedence over other libraries with the same name.
#+BEGIN_SRC emacs-lisp
(unless (file-exists-p jf-load-path)
(make-directory jf-load-path))
(let ((default-directory jf-load-path))
(setq load-path
(append
(let ((load-path (copy-sequence load-path)))
(append
(copy-sequence (normal-top-level-add-to-load-path '(".")))
(normal-top-level-add-subdirs-to-load-path)))
load-path)))
#+END_SRC
*** File Not Found Functions
Offer to create parent folders when a file is opened
Offer to create nonexistant parent directories.
#+BEGIN_SRC emacs-lisp
(defun jf-create-nonexistant-directories ()
(let ((parent-directory (file-name-directory buffer-file-name)))
(when (and (not (file-exists-p parent-directory))
(y-or-n-p (format "Directory `%s' does not exist. Create it?" parent-directory)))
(make-directory parent-directory t)))) ; last argument specifies to behave like `mkdir -p'
(add-to-list 'find-file-not-found-functions #'jf-create-nonexistant-directories)
#+END_SRC
*** Customize Location
Make changes in =M-x customize= go somewhere other than being schlunked into =init.el= .
#+BEGIN_SRC emacs-lisp
(setq custom-file (concat user-emacs-directory "_customize.el"))
(load custom-file t)
#+END_SRC
*** Disable Bell
Shut up, emacs.
#+BEGIN_SRC emacs-lisp
(setq ring-bell-function #'ignore)
2018-12-08 16:19:55 -05:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Shorter Prompts
Make =yes-or-no= prompts ask for =y-or-n= instead. Saves loads of time™.
2018-12-21 11:54:00 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(defalias 'yes-or-no-p #'y-or-n-p)
2018-12-21 11:54:00 -05:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Move Backup Files
By default, emacs gunks up every folder with =file~= backups
and =#file#= lockfiles. Schlunk them all in =/tmp= instead.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Secure auth-source
GPG encrypt stored auth tokens from [[https://www.gnu.org/software/emacs/manual/html_mono/auth.html ][auth-source ]] instead of storing them in plaintext.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq auth-sources '("~/.emacs.d/authinfo.gpg"))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Use UTF-8
Pleeeease default to UTF-8, Emacs.
2019-02-05 23:47:18 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
2019-02-05 23:47:18 -05:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Trash when Deleting
Don't permanently delete stuff unless asked.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq delete-by-moving-to-trash t)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Open Compressed Files
...automatically.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq auto-compression-mode t)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Save Minibuffer History
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(savehist-mode 1)
(setq history-length 1000)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Double Spaces
Why sentences would need double spaces to end I do not know.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(set-default 'sentence-end-double-space nil)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Eval Print Level
Print more stuff when running =C-x C-e= or =(eval-last-sexp)=
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq eval-expression-print-level 100)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:34:50 -05:00
*** GC in Minibuffer
Don't garbage collect while the minibuffer is open, as heavy
things like completion and searches are happening and will
slow down with many garbage collections.
#+BEGIN_SRC emacs-lisp
(add-hook 'minibuffer-setup-hook #'jf-inhibit-gc)
(add-hook 'minibuffer-exit-hook #'jf-resume-gc)
#+END_SRC
2019-02-10 14:09:23 -05:00
** UI
*** Font
Engage a nice coding font.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(add-to-list 'default-frame-alist '(font . "Fira Code 12"))
(set-face-attribute 'default t :font "Fira Code 12")
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Menu Bar
Disable the useless cruft at the top of the screen.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Modeline
**** Diminish
Adds support for =:diminish= in use-package declarations, which hides a mode from the modeline.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package diminish)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
**** Column Number
Show line and column numbers in the modeline.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq line-number-mode t)
(setq column-number-mode t)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Line Numbers
Use the default emacs relative line numbers, but switch to absolute lines when in insert mode.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package nlinum-relative
:config
(nlinum-relative-setup-evil)
:hook (prog-mode . nlinum-relative-mode))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Show Matching Parens
Shows matching parenthesis
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(require 'paren)
(setq show-paren-delay 0)
(show-paren-mode)
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Scrolling
Scroll smooth-ish-ly instead of jarring jumps.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package smooth-scroll
2018-10-15 18:28:02 -04:00
:config
2019-02-10 14:09:23 -05:00
(smooth-scroll-mode t))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Dashboard
Show a cool custom dashboard buffer on startup.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package dashboard
2018-10-15 18:28:02 -04:00
:diminish page-break-lines-mode
:config
(dashboard-setup-startup-hook)
2019-02-10 14:09:23 -05:00
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard* ")))
2018-10-15 18:28:02 -04:00
:custom
(dashboard-startup-banner 'logo)
2019-02-10 14:34:50 -05:00
(dashboard-banner-logo-title
(format "Welcome to Electronic Macs. Ready in %.2f seconds with %d GCs."
(float-time (time-subtract after-init-time before-init-time))
gcs-done))
2018-10-15 18:28:02 -04:00
(dashboard-items
2019-02-10 14:09:23 -05:00
'((recents . 5)
(agenda)
(bookmarks . 5)
(registers . 5))))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Themes
*** pywal
Fancy dynamic color scheme generation from desktop wallpapers.
Requires additional setup on the machine itself.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(defvar jf-theme-pywal-path "~/.cache/wal/colors.el" "Path to the colorscheme generated by pywal.")
(defun jf-theme-pywal ()
(load-file jf-theme-pywal-path))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** spacemacs
This theme is pretty fancy and has lots of supported modes.
2018-10-27 01:04:21 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(unless (package-installed-p 'spacemacs-theme)
(package-install 'spacemacs-theme))
2018-10-27 13:05:58 -04:00
2019-02-10 14:09:23 -05:00
(defun jf-theme-spacemacs ()
(load-theme 'spacemacs-dark))
2018-10-27 01:04:21 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Transparency
Sets the window's transparency, to better admire choice wallpapers.
The first number in the alpha section applies when the window is
active, the second when it's inactive.
2018-10-27 01:04:21 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(set-frame-parameter (selected-frame) 'alpha 85)
(add-to-list 'default-frame-alist '(alpha . 85))
2018-10-27 01:04:21 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Helpers
#+BEGIN_SRC emacs-lisp
2019-04-25 18:25:20 -04:00
(defvar jf-theme #'jf-theme-spacemacs "Theme function to call.")
2019-02-10 14:09:23 -05:00
(defun jf-apply-theme ()
"Apply the current theme as set by jf-theme."
(funcall jf-theme))
2018-10-27 01:04:21 -04:00
2019-02-10 14:09:23 -05:00
(jf-apply-theme)
#+END_SRC
* Organization
** Capture Templates
All capture templates, from tasks to bookmarks.
*** Refile Targets
Goodize the refiling targets to allow refiling to arbitrary subtrees.
2018-10-27 13:05:58 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(defun jf-org-capture-refile ()
(interactive)
(setq-local org-refile-targets '((nil :maxlevel . 5)))
(setq-local org-refile-use-outline-path t)
(org-refile))
2018-10-27 13:05:58 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Tasks
#+BEGIN_SRC emacs-lisp
(setq jf-org-capture-task-templates
'(("t" "Todo")
("tg" "General" entry
(file+headline "notes.org" "Todo")
"** TODO %^{todo}\nNotes: %?\n")
("tt" "General (Date)" entry
(file+olp+datetree "notes.org")
"*** TODO %^{todo}\nDue: %^t\nNotes: %?\n")
("tT" "General (Date+Time)" entry
(file+olp+datetree "notes.org")
"*** TODO %^{todo}\nDue: %^T\nNotes: %?\n")
("ts" "School (Date)" entry
(file+olp+datetree "notes.org")
"*** TODO %^{todo}\nDue: %^t\nClass: %^{class}\nNotes: %?\n")
("tS" "School (Date+Time)" entry
(file+olp+datetree "notes.org")
"*** TODO %^{todo}\nDue: %^T\nClass: %^{class}\nNotes: %?\n")))
#+END_SRC
*** Bookmarks
#+BEGIN_SRC emacs-lisp
(setq jf-org-capture-bookmark-templates
'(("b" "Bookmark" entry
(file+headline "links.org" "Unsorted Links")
"** [[%^{link} ][%^{name} ]]\nCreated: %U\nAbout: %^{description}%?\n")))
#+END_SRC
*** Personal
#+BEGIN_SRC emacs-lisp
(setq jf-org-capture-personal-templates
'(("j" "Journal")
("jj" "Journal Entry" entry
(file+olp+datetree "journal.org")
"**** Today's Events\n%?")
("jt" "Thoughts" entry
(file+headline "notes.org" "Thoughts")
"** %^{summary}\n%U\n%?")
("jd" "Dream Journal Entry" entry
(file+olp+datetree "dreams.org")
"**** Dream\n%?")))
#+END_SRC
*** Protocol
#+BEGIN_SRC emacs-lisp
(setq jf-org-capture-protocol-templates
'(("w" "Website" entry
(file+headline "sites.org" "Unsorted Sites")
"** [[%:link ][%:description%? ]]\nCreated: %U\nAbout: %^{description}%?\n%:initial")))
#+END_SRC
*** All
2018-10-27 01:04:21 -04:00
Tie it all together.
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-org-capture-templates
(append
jf-org-capture-task-templates
jf-org-capture-personal-templates
jf-org-capture-bookmark-templates
jf-org-capture-protocol-templates))
2018-10-27 01:04:21 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Structure Templates
2018-10-27 01:04:21 -04:00
Defines expansions with =<= followed by a string in org-mode.
2019-02-10 14:09:23 -05:00
*** Source Blocks
2018-10-27 01:04:21 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-org-source-structure-templates
'(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")))
2018-10-27 01:04:21 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** All
2018-10-27 01:04:21 -04:00
Tie it all together.
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-org-structure-templates
2018-10-27 01:04:21 -04:00
(append
2019-02-10 14:09:23 -05:00
jf-org-source-structure-templates))
2018-10-27 01:04:21 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Org-mode
2018-10-15 18:28:02 -04:00
Keep org-mode up to date straight from the cow's utters.
If the manual is not on your computer, it's [[https://orgmode.org/manual/ ][here ]].
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package org
2018-10-15 18:28:02 -04:00
:pin org
:mode ("\\.org\\'" . org-mode)
2018-10-27 10:54:15 -04:00
:hook ((org-mode . org-indent-mode)
(org-capture-mode . evil-insert-state))
2018-10-15 18:28:02 -04:00
:general
2019-02-10 14:09:23 -05:00
(jf-major-def
:keymaps 'org-mode-map
"e" 'org-export-dispatch
"a" 'org-attach)
(jf-org-def
"a" 'org-agenda
"c" 'org-capture
"l" 'org-store-link
"b" 'org-switchb
"r" 'jf-org-capture-refile)
2018-10-15 18:28:02 -04:00
:custom
(org-directory "~/Documents/org")
(org-agenda-files '("~/Documents/org/ "))
(org-default-notes-file "notes.org")
(org-agenda-include-diary t)
(org-src-window-setup 'current-window "Edit source code in the current window")
(org-src-fontify-natively t "Highlight syntax in source blocks")
(org-latex-to-pdf-process '("latexmk -f pdf %f") "Use pdflatex for export")
2019-02-10 14:09:23 -05:00
(org-capture-templates jf-org-capture-templates)
(org-structure-template-alist (append org-structure-template-alist jf-org-structure-templates)))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Pretty org-mode bullets
2018-10-15 18:28:02 -04:00
Make bullets look choice
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package org-bullets
2018-10-15 18:28:02 -04:00
:hook (org-mode . org-bullets-mode))
#+END_SRC
2019-02-10 14:09:23 -05:00
* Communication
* Web
* Tools
2018-10-15 18:28:02 -04:00
** Fuzzy Matching
2019-02-10 14:09:23 -05:00
Most facilities are provided by [[https://github.com/abo-abo/swiper ][Ivy ]] and friends, which build on existing emacs commands.
*** Smex
While the actual smex command is not in use,
counsel-M-x will use it for sorting by usage.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package smex)
#+END_SRC
*** Ivy
#+BEGIN_SRC emacs-lisp
(use-package ivy
2018-10-15 18:28:02 -04:00
:init
2019-02-10 14:09:23 -05:00
(defun jf-kill-current-buffer ()
(interactive)
(kill-buffer (current-buffer)))
(defun jf-kill-all-buffers ()
(interactive)
(seq-do 'kill-buffer (buffer-list)))
2018-10-15 18:28:02 -04:00
:general
2019-02-10 14:09:23 -05:00
(jf-buffers-def
"b" 'ivy-switch-buffer
"v" 'ivy-push-view
"V" 'ivy-pop-view
"c" 'jf-kill-current-buffer
"C" 'jf-kill-all-buffers)
2018-10-15 18:28:02 -04:00
:custom
(ivy-use-virtual-buffers t)
(ivy-count-format "%d/%d"))
2019-02-10 14:09:23 -05:00
#+END_SRC
*** Counsel
A collection of ivy enhanced versions of common Emacs commands.
#+BEGIN_SRC emacs-lisp
(use-package counsel
2018-10-15 18:28:02 -04:00
:general
("M-x" 'counsel-M-x)
2019-02-10 14:09:23 -05:00
(jf-leader-def
:states 'normal
"x" 'counsel-M-x)
(jf-files-def
"f" 'counsel-find-file)
(jf-help-def
"a" 'counsel-apropos
"f" 'counsel-describe-function
"k" 'counsel-descbinds
"l" 'counsel-find-library
"s" 'counsel-info-lookup-symbol
"u" 'counsel-unicode-char
"v" 'counsel-describe-variable))
#+END_SRC
*** Swiper
An ivy-ified replacement for isearch.
#+BEGIN_SRC emacs-lisp
(use-package swiper
:after evil
:general
(:keymaps 'override
:states 'normal
"/" 'swiper
"n" 'evil-search-previous
"N" 'evil-search-next))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Neotree
A cool toggleable directory structure sidebar.
It needs icon fonts, installed with =M-x all-the-icons-install-fonts= .
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package all-the-icons)
(use-package neotree
:after all-the-icons
2018-10-15 18:28:02 -04:00
:general
2019-02-10 14:09:23 -05:00
(jf-apps-def
"t" 'neotree-toggle)
:custom
(neo-theme (if (display-graphic-p) 'icons 'arrow)))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Ranger
Brings the glory of [[https://github.com/ralesi/ranger.el ][Ranger ]] to Emacs.
2019-02-04 23:50:28 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package ranger
:commands (ranger deer))
2019-02-04 23:50:28 -05:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Sunshine
Allows retrieving OpenWeatherMap forecasts in the minibuffer.
2019-02-06 18:33:46 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package sunshine
:commands sunshine-forecast
:general
(jf-apps-def
"w" #'sunshine-forecast)
:custom
2019-02-10 15:14:46 -05:00
(sunshine-location "Piscataway, US")
(sunshine-units 'metric)
2019-02-10 14:09:23 -05:00
(sunshine-appid "7caf100277f14845e7f354c6590a09cb")
(sunshine-show-icons t))
2019-02-06 18:33:46 -05:00
#+END_SRC
2019-02-10 14:09:23 -05:00
* Programming
2019-05-03 08:58:47 -04:00
** Formatting
*** Word Wrap
2019-05-01 13:03:18 -04:00
#+BEGIN_SRC emacs-lisp
2019-05-03 08:58:47 -04:00
(defun jf-word-wrap (column)
"Enable auto refill mode at COLUMN."
(interactive "nFill column: ")
(setq-local fill-column column)
(refill-mode))
2019-05-01 13:03:18 -04:00
2019-05-03 08:58:47 -04:00
(defun jf-nowrap ()
"Disable auto refill mode."
(interactive)
(refill-mode))
2019-05-01 13:03:18 -04:00
#+END_SRC
2019-02-06 18:33:46 -05:00
*** Indentation
Set some *sane* defaults
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-tab-width 4)
(setq-default python-indent-offset jf-tab-width)
(setq-default evil-shift-width jf-tab-width)
(setq-default c-basic-offset jf-tab-width)
2019-02-06 18:33:46 -05:00
; Disable annoying electric indent of previous lines
(setq-default electric-indent-inhibit t)
; Eat the whole tab when I press backspace
(setq backward-delete-char-untabify-method 'hungry)
#+END_SRC
Define some *useful* helper functions
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(defun jf-indent-tabs (width)
(interactive "nTab width: ")
(setq tab-width width)
(local-set-key (kbd "TAB") 'tab-to-tab-stop)
(setq indent-tabs-mode t))
(defun jf-indent-spaces (num)
(interactive "nNumber of spaces: ")
(setq tab-width num)
(setq indent-tabs-mode nil))
2019-03-11 10:55:44 -04:00
;; Default to 4 spaces
(add-hook 'prog-mode-hook #'jf-indent-4-spaces)
2019-02-10 14:09:23 -05:00
;; Define functions for every level of indent that might need hooking
(cl-macrolet
((jf-define-indent-funs (widths)
`(progn
,@(mapcan
(lambda (num)
`((defun ,(intern (concat "jf-indent-" (number-to-string num) "-spaces")) ()
(jf-indent-spaces ,num))
(defun ,(intern (concat "jf-indent-tabs-" (number-to-string num))) ()
(jf-indent-tabs ,num))))
widths))))
(jf-define-indent-funs (2 4 8)))
;; TODO: Replace with dedicated whitespace config
(setq whitespace-style '(face tabs tab-mark trailing))
(custom-set-faces
'(whitespace-tab ((t (:foreground "#636363")))))
;; Make tabs visible
(setq whitespace-display-mappings
'((tab-mark 9 [124 9] [92 9])))
(add-hook 'prog-mode-hook #'whitespace-mode)
#+END_SRC
*** Parentheses
**** Smartparens
[[https://github.com/Fuco1/smartparens ][Smartparens ]] handles parens for languages that aren't lispy.
#+BEGIN_SRC emacs-lisp
(use-package smartparens
:diminish
:commands smartparens-mode
:config
(require 'smartparens-config))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
**** ParEdit
And [[https://www.emacswiki.org/emacs/ParEdit ][ParEdit ]] handles the rest.
2018-12-21 12:39:15 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package paredit
2018-12-21 12:39:15 -05:00
:diminish
:commands enable-paredit-mode)
#+END_SRC
2019-05-03 09:02:33 -04:00
**** Lispyville
And now Lispyville handles the rest.
#+BEGIN_SRC emacs-lisp
(use-package lispyville
:commands lispyville-mode
:config
(lispyville-set-key-theme
'(operators
c-w
slurp/barf-cp
commentary
(escape insert)
(additional-movement normal visual motion))))
#+END_SRC
2019-02-10 14:09:23 -05:00
**** Evil-Cleverparens
[[https://github.com/luxbock/evil-cleverparens ][Evil-Cleverparens ]] adds additional features to Evil all about
working with sexps, including keeping parens balanced when
using commands like =dd= .
2018-12-21 12:39:15 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package evil-cleverparens
2018-12-21 12:39:15 -05:00
:diminish
2019-02-10 14:09:23 -05:00
:commands evil-cleverparens-mode)
2018-12-21 12:39:15 -05:00
#+END_SRC
2019-05-03 09:02:33 -04:00
**** Activation
Add a hook to enable paren helper modes for any prog-mode buffer
#+BEGIN_SRC emacs-lisp
(defun jf-paren-mode ()
"Pick a suitable parenthesis mode for the current major mode."
(electric-pair-mode)
(if (member major-mode '(emacs-lisp-mode
lisp-mode
lisp-interaction-mode
scheme-mode))
(lispyville-mode)
(smartparens-mode)))
(add-hook 'prog-mode-hook #'jf-paren-mode)
#+END_SRC
2019-05-01 13:03:18 -04:00
**** Helpers
Helpers for wrangling sexps
#+BEGIN_SRC emacs-lisp
(jf-kbd-defmacro jf-wrap-fn-inline
2019-05-03 09:02:33 -04:00
"ESC i C-q { RET TAB ESC jI} SPC ESC k^")
2019-05-01 13:03:18 -04:00
(jf-kbd-defmacro jf-wrap-fn-line
2019-05-03 09:02:33 -04:00
"ESC kA SPC C-q { ESC jjI} SPC ESC k^")
2019-05-01 13:03:18 -04:00
(jf-kbd-defmacro jf-wrap-fn-sexp
2019-05-03 09:02:33 -04:00
"ESC i C-q { RET TAB ESC )i} ESC i RET ESC k^")
2019-02-10 14:09:23 -05:00
#+END_SRC
*** Whitespace
**** ws-butler
2018-12-21 12:47:29 -05:00
Unobtrusively cleans up whitespace before EOLs
as you edit, stopping the noisy commits generated
from blanket trimming entire files.
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package ws-butler
2018-12-21 12:47:29 -05:00
:hook (prog-mode . ws-butler-mode))
#+END_SRC
2018-10-15 18:28:02 -04:00
*** pretty-mode
2019-02-10 14:09:23 -05:00
[[https://github.com/pretty-mode/pretty-mode ][pretty-mode ]] redisplays parts of the Emacs buffer as pretty symbols.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package pretty-mode
2018-10-15 18:28:02 -04:00
:hook (prog-mode . pretty-mode)
:config
2019-02-10 14:09:23 -05:00
(pretty-deactivate-groups '(:arithmetic
:sub-and-superscripts))
(pretty-activate-groups '(:equality
:ordering
:ordering-double
:ordering-triple
:arrows
:arrows-twoheaded
:punctuation
:logic
:sets)))
#+END_SRC
*** Prettify-Symbols-Mode
Allows custom unicode replacement of symbols. Fill in the gaps where
pretty-mode left off.
**** Python
#+BEGIN_SRC emacs-lisp
(defun jf-prettify-python ()
(dolist (pair '(;; Syntax
("in" . #x2208)
("not in" . #x2209)
("return" . #x27fc)
("yield" . #x27fb)
("for" . #x2200)
;; Base Types
("int" . #x2124)
("float" . #x211d)
("str" . #x1d54a)
("True" . #x1d54b)
("False" . #x1d53d)))
(push pair prettify-symbols-alist)))
(add-hook 'python-mode-hook #'prettify-symbols-mode)
(add-hook 'python-mode-hook #'jf-prettify-python)
#+END_SRC
** Checkers
2018-10-18 10:29:46 -04:00
*** Flycheck
2019-02-10 14:09:23 -05:00
Flycheck highlights syntax errors in a few languages.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package flycheck
:hook (prog-mode . flycheck-mode))
2018-10-15 18:28:02 -04:00
#+END_SRC
2018-10-18 10:29:46 -04:00
*** Column 80 Highlight
Add a hotkey for highlighting column 80
and activate it in =prog-mode=
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package fill-column-indicator
2018-10-18 10:29:46 -04:00
:init
(setq fci-rule-use-dashes t)
(setq fci-rule-column 80)
:general
2019-02-10 14:09:23 -05:00
(jf-major-def
:keymaps 'prog-mode-map
"8" 'fci-mode))
2018-10-18 10:29:46 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Completion
*** Company
Company auto-completes stuff in the buffer, and company-quickhelp shows
documentation popups when idling on a completion candidate.
#+BEGIN_SRC emacs-lisp
(use-package company
:hook (prog-mode . company-mode)
:general
(:keymaps 'company-active-map
"C-SPC" 'company-abort)
:custom
(company-maximum-prefix-length 2)
(company-idle-delay 0.2 "Decrease idle delay"))
(use-package company-quickhelp
:after company
:hook (company-mode . company-quickhelp-mode))
#+END_SRC
2018-10-15 18:28:02 -04:00
** Snippets
Yasnippet adds support for custom snippets
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package yasnippet
2018-10-15 18:28:02 -04:00
:hook (prog-mode . yas-minor-mode)
:custom
(yas-snippet-dirs
2019-02-10 14:09:23 -05:00
'("~/.emacs.d/snippets"
"~/.emacs.d/elpa/yasnippet-snippets-0.6/snippets")))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
** Debugging
*** Realgud
[[https://github.com/realgud/realgud ][Realgud ]] is a modular frontend for many debuggers, right in Emacs.
#+BEGIN_SRC emacs-lisp
(use-package realgud
:commands
(realgud:gdb
realgud:lldb
realgud:node-inspect
realgud:pdb
realgud:trepan3k))
#+END_SRC
*** RMSbolt
[[https://github.com/emacsmirror/rmsbolt ][RMSbolt ]] Shows disassembly in a buffer next to code, highlighting relevant regions.
#+BEGIN_SRC emacs-lisp
(use-package rmsbolt
:commands rmsbolt-mode)
#+END_SRC
2018-10-15 18:28:02 -04:00
** Git
2019-02-10 14:09:23 -05:00
*** Magit
2018-10-15 18:28:02 -04:00
It's magic git!
2018-12-08 05:47:00 -05:00
Keybinds [[https://github.com/emacs-evil/evil-magit ][here ]]
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package magit
:general
(jf-git-def
"b" 'magit-blame-addition
"B" 'magit-blame-reverse
"s" 'magit-status))
2019-02-06 23:48:47 -05:00
#+END_SRC
It's *evil* magic git!
#+BEGIN_SRC emacs-lisp
(use-package evil-magit
:after (evil magit))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Forge
2019-02-06 23:48:47 -05:00
Magic GitHub facilities for git forges such as GitHub and GitLab!
2018-12-21 11:54:00 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-06 23:48:47 -05:00
(use-package forge
2019-03-11 10:55:57 -04:00
:after magit)
2019-02-10 14:09:23 -05:00
#+END_SRC
*** Smeargle
Highlights regions in files by last update time.
Older regions are more whitey and newer regions are more blacky.
#+BEGIN_SRC emacs-lisp
(use-package smeargle
:general
(jf-git-def
"H t" 'smeargle
"H h" 'smeargle-commits
"H c" 'smeargle-clear))
2018-12-21 11:54:00 -05:00
#+END_SRC
2018-10-16 22:02:11 -04:00
** Projects
Projectile provides project-level features like
make shortcuts and file switching
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package projectile
:defer t
:preface
(defvar jf-projects-path "~/Documents/dev")
2018-10-27 11:05:29 -04:00
2019-02-10 14:09:23 -05:00
:general
(jf-leader-def
"p" '(:keymap projectile-command-map))
2019-02-01 09:17:35 -05:00
:config
(projectile-mode 1)
2019-02-10 14:09:23 -05:00
;; Discover projects in jf-projects-path
(let ((subdirs (directory-files jf-projects-path t)))
(dolist (dir subdirs)
(unless (member (file-name-nondirectory dir) '(".." "."))
(when (file-directory-p dir)
(let ((default-directory dir)
(projectile-cached-project-root dir))
(when (projectile-project-p)
(projectile-add-known-project (projectile-project-root))))))))
2018-10-18 10:29:46 -04:00
:custom
2019-02-01 09:17:35 -05:00
(projectile-completion-system 'ivy)
2019-02-10 14:09:23 -05:00
(projectile-project-search-path (list jf-projects-path)))
2018-10-16 22:02:11 -04:00
#+END_SRC
2018-10-15 18:28:02 -04:00
** Languages
2019-04-25 18:25:37 -04:00
*** Language Server Protocol
Mode for integration with lots of language servers, interacting with company,
flycheck, projectile, and the works.
#+BEGIN_SRC emacs-lisp
(use-package lsp-mode
:commands lsp)
(use-package lsp-ui
:commands lsp-ui-mode)
(use-package company-lsp
:commands company-lsp)
#+END_SRC
2018-10-15 18:28:02 -04:00
*** Fish
2019-02-10 14:09:23 -05:00
Mode for editing of scripts for the fish shell.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package fish-mode
2018-10-15 18:28:02 -04:00
:mode "\\.fish\\'")
#+END_SRC
*** Markdown
2019-02-10 14:09:23 -05:00
Mode for editing markdown.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package markdown-mode
2018-10-15 18:28:02 -04:00
:mode "\\.md\\'")
#+END_SRC
*** Python
2019-02-10 14:09:23 -05:00
Jedi for autocompletion sources in python-mode.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package company-jedi
2019-02-06 18:47:02 -05:00
:company python-mode)
2018-10-15 18:28:02 -04:00
#+END_SRC
*** Javascript
2019-02-10 14:09:23 -05:00
[[https://github.com/mooz/js2-mode ][js2-mode ]] improves the default js mode.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package js2-mode
2018-10-15 18:28:02 -04:00
:mode "\\.js\\'"
:interpreter "node")
#+END_SRC
2019-02-10 14:09:23 -05:00
*** Web
2018-10-15 18:28:02 -04:00
Web-mode should give everything you need for a web-dev major mode.
2019-02-10 14:09:23 -05:00
Company integration is done with company-web.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package web-mode
2018-10-15 18:28:02 -04:00
:mode ("\\.html\\'"
"\\.php\\'"
"\\.blade\\.")
:custom
(web-mode-code-indent-offset 4)
(web-mode-indent-style 4))
2019-02-06 18:47:02 -05:00
2019-02-10 14:09:23 -05:00
(use-package company-web
2019-02-06 18:47:02 -05:00
:company web-mode)
2018-10-15 18:28:02 -04:00
#+END_SRC
*** JSON
2019-02-10 14:09:23 -05:00
Mode for editing JSON files.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package json-mode
2018-10-15 18:28:02 -04:00
:mode "\\.json\\'")
#+END_SRC
*** YAML
2019-02-10 14:09:23 -05:00
Mode for editing YAML files.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package yaml-mode
2018-10-15 18:28:02 -04:00
:mode "\\.yaml\\'")
#+END_SRC
*** Arch PKGBUILD
2019-02-10 14:09:23 -05:00
Mode for editing PKGBUILD files.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package pkgbuild-mode
2018-10-15 18:28:02 -04:00
:mode ".*PKGBUILD\\'")
#+END_SRC
*** LaTeX
2018-11-05 16:58:07 -05:00
**** AUCTeX
2019-02-10 14:09:23 -05:00
AUCTeX is a major mode for editing TeX.
Company completions are handled by company-auctex and company-math.
2018-10-15 18:28:02 -04:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package tex
2018-10-15 18:28:02 -04:00
:defer t
:ensure auctex
2018-10-18 10:29:46 -04:00
:general
2019-02-10 14:09:23 -05:00
(jf-major-def
:keymaps 'TeX-mode-map
"e" 'TeX-command-run-all)
2018-10-15 18:28:02 -04:00
:custom
(TeX-auto-save t))
2019-02-06 18:47:02 -05:00
2019-02-10 14:09:23 -05:00
(use-package company-auctex
2019-02-06 18:47:02 -05:00
:company LaTeX-mode)
2018-10-18 10:29:46 -04:00
2019-02-10 14:09:23 -05:00
(use-package company-math
2019-02-06 18:47:02 -05:00
:company ((TeX-mode . company-math-symbols-latex)
(TeX-mode . company-math-symbols-unicode)
(TeX-mode . company-latex-commands)))
2018-10-15 18:28:02 -04:00
#+END_SRC
2019-02-10 14:09:23 -05:00
**** Cdlatex
cdlatex adds better TeX-specific template expansions and other niceties.
2018-11-05 17:27:57 -05:00
***** Environment
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-cdlatex-envs nil)
2018-11-05 17:27:57 -05:00
#+END_SRC
***** Commands
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-cdlatex-commands nil)
2018-11-05 17:27:57 -05:00
#+END_SRC
***** Math Symbols
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(setq jf-cdlatex-symbols
'((?I ("\\infty"))))
2018-11-05 17:27:57 -05:00
#+END_SRC
2019-02-10 14:09:23 -05:00
***** Setup
2018-11-05 16:58:07 -05:00
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package cdlatex
2018-11-05 17:27:57 -05:00
:hook (LaTeX-mode . cdlatex-mode)
:custom
2019-02-10 14:09:23 -05:00
(cdlatex-env-alist jf-cdlatex-envs)
(cdlatex-command-alist jf-cdlatex-commands)
(cdlatex-math-symbol-alist jf-cdlatex-symbols))
2018-11-05 16:58:07 -05:00
#+END_SRC
2018-12-01 14:44:54 -05:00
*** Rust
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package rust-mode
2018-12-21 11:02:05 -05:00
:mode "\\.rs\\'"
2019-02-10 14:09:23 -05:00
:general)
2018-12-21 11:02:05 -05:00
2019-02-10 14:09:23 -05:00
(use-package flycheck-rust
:after flycheck
2018-12-21 11:02:05 -05:00
:hook (rust-mode . flycheck-rust-setup))
2019-02-10 14:09:23 -05:00
(use-package racer
2018-12-21 11:02:05 -05:00
:hook ((rust-mode . racer-mode)
(rust-mode . eldoc-mode))
:custom
(racer-cmd "~/.cargo/bin/racer")
(racer-rust-src-path "~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src"))
2019-02-10 14:09:23 -05:00
(use-package cargo
2018-12-21 11:02:05 -05:00
:hook (rust-mode . cargo-minor-mode)
:general
2019-02-10 14:09:23 -05:00
(jf-major-def
:keymaps 'rust-mode-map
"b" #'cargo-process-build
"r" #'cargo-process-run
"t" #'cargo-process-test))
2018-12-01 14:44:54 -05:00
#+END_SRC
2018-10-15 18:28:02 -04:00
*** C/C++
2018-11-05 16:48:52 -05:00
**** Irony
2018-10-15 18:28:02 -04:00
Irony handles enhanced C/C++ operations powered by clang
company-irony for company integration
#+BEGIN_SRC emacs-lisp
2019-02-10 14:09:23 -05:00
(use-package irony
:hook ((c-mode c++-mode) . irony-mode)
(irony-mode . irony-cdb-autosetup-compile-options))
2018-10-15 18:28:02 -04:00
2019-02-10 14:09:23 -05:00
(use-package flycheck-irony
:after flycheck
:hook (irony-mode . flycheck-irony-setup))
2018-10-15 18:28:02 -04:00
2019-02-10 14:09:23 -05:00
(use-package company-irony
2019-02-06 18:47:02 -05:00
:company irony-mode)
2019-02-05 23:47:45 -05:00
2019-02-10 14:09:23 -05:00
(use-package company-irony-c-headers
:company irony-mode)
2018-11-05 16:48:52 -05:00
#+END_SRC
2019-02-12 14:36:56 -05:00
*** Lua
#+BEGIN_SRC emacs-lisp
(use-package lua-mode
:mode "\\.lua\\'")
(use-package company-lua
:company lua-mode)
#+END_SRC
2019-04-25 18:25:37 -04:00
*** Elixir
#+BEGIN_SRC emacs-lisp
(use-package elixir-mode
:mode "\\.exs?\\'"
:hook (elixir-mode . lsp))
2019-05-03 09:02:33 -04:00
#+END_SRC
2019-04-22 18:41:34 -04:00
*** Java
**** Eclim
Secretly actually use eclipse in the background in the form of eclimd
for all of the IDE like features.
#+BEGIN_SRC emacs-lisp
(use-package eclim
:hook ((java-mode . eclim-mode)
(java-mode . jf-indent-4-spaces))
:custom
(eclimd-default-workspace "~/Documents/dev/workspace")
(eclimd-autostart-with-default-workspace t)
(eclimd-autostart t))
(use-package company-emacs-eclim
:company java-mode)
2019-04-25 18:25:37 -04:00
#+END_SRC
2019-04-22 18:41:34 -04:00
**** Gradle
2019-05-03 09:02:33 -04:00
The std:: java build system
2019-04-22 18:41:34 -04:00
#+BEGIN_SRC emacs-lisp
(use-package gradle-mode
:commands gradle-mode)
2019-05-03 09:02:33 -04:00
#+END_SRC