Skip to content
No description, website, or topics provided.
Emacs Lisp YASnippet
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Lani’s Emacs


This is my emacs configuration. It’s an org-mode document which gets parsed into an elisp file via org-babel. The init.el file is really short but it shows how to do this.


Most of this was stolen from uncle dave’s emacs. He has some really nice youtube tutorials here. You can find his emacs config here.


To automatically install this, simply run git clone in your home directory. Make sure your emacs.d is empty. Otherwise, you can copy and paste bits and pieces of this config file into your config file.


I sometimes like to use the EXWM window manager. I’m sticking with i3 on my home gaming machine but if I ever get a machine that I only use for programming I may switch back. I’m leaving the config here either way, though I do setup some org headers to stop it from being compiled

Allow focus to follow the mouse

I always found it quite painful to move around without this

 (setq mouse-autoselect-window t
	focus-follows-mouse t)

Basic setup

This is a hodgepodge of stuff and I really need to organize this. I also need to figure out how to make the EXWM Randr Stuff system dependent but I’m too lazy


I need to add to this. More Super-key functions would be nice to reduce all the mouse use I have to do

(global-set-key (kbd "s-d") 'async-shell-command)

Start programs in char mode

EXWM distinguishes between two minor modes, char and line. I’m not entirely sure what the difference is but it has something to do with sending key combos.

(setq exwm-manage-configurations '((t char-mode t)))


Various asthetic changes really make a difference when you’re staring at a screen all day

Modelines lines and columns

This just fixes the line/column number display in the modeline

(line-number-mode 1)
(column-number-mode 1)

Highlights the current line

This just highlights whatever line your cursor is on. I may disable it

(when window-system (global-hl-line-mode t))

Prettify symbols

Really nice package that turns text symbols into their unicode equivalents

(use-package pretty-mode)
(when window-system (global-pretty-mode t))

Line numbers

Display line numbers on the side of the buffer, but only in prog mode (otherwise you run into issues with, for example, ansi-term)

(add-hook 'prog-mode-hook 'display-line-numbers-mode)


So many themes, I can’t choose. Right now I’m using zerodark but I have some of my favorite old themes installed so I can switch any time with M-x load-theme

(defadvice load-theme (before theme-dont-propagate activate)
  (mapc #'disable-theme custom-enabled-themes))
(use-package alect-themes)
(use-package zenburn-theme)
(use-package zerodark-theme)
(use-package gruvbox-theme)
(load-theme 'zerodark t)


This package highlights hex colors, for example #fecf6a in the color they represent.

(use-package rainbow-mode)
(define-globalized-minor-mode global-rainbow-mode rainbow-mode
  (lambda () (rainbow-mode 1)))
(global-rainbow-mode 1)

Rainbow Delims

This package highlights pairs of parenthesis in different colors so you can see how they line up. This is a borderline necessity for anything emacs lisp

(use-package rainbow-delimiters)

(define-globalized-minor-mode global-rainbow-delimeters-mode rainbow-delimiters-mode
  (lambda()(rainbow-delimiters-mode 1)))

(global-rainbow-delimeters-mode 1)


Package called dashboard, sets up a startup screen with my recently used projects.

(use-package dashboard)
(setq dashboard-items '((recents . 10)))
(setq dashboard-banner-logo-title "Howdy Lani!")


Clock in the modeline. Not too complex

(display-time-mode 1)


Restyles the modeline to look more like spacemacs.

(use-package spaceline)
(require 'spaceline-config)
(setq powerline-default-separator (quote arrow))


Makes it so I can see my beautiful wallpaper

(set-frame-parameter (selected-frame) 'alpha '(80 . 80))

Nyan mode

(use-package nyan-mode)
(define-globalized-minor-mode global-nyan-mode nyan-mode
    (nyan-mode 1)


Org mode is really nice, its the reason I use emacs. This document is written in orgmode

Org Bullets

Changes the ugly asterisks to nice pretty bullets.

(use-package org-bullets
  :config (add-hook 'org-mode-hook (lambda()(org-bullets-mode))))

Better source editing

Makes it so when you edit embedded source code, you edit it in the same window instead of opening a new one

(setq org-src-window-setup 'current-window)

Fix image width issues

Org mode annoyingly displays images at their actual size no matter what. This lets you view images at the size described in the annotations

(setq org-image-actual-width nil)

Wrap lines

(add-hook 'org-mode-hook (lambda()


Some changes that make emacs function better

Kill ring menu

This gives you a list of everything you’ve copied when you paste with M-y

(use-package popup-kill-ring)
(global-set-key (kbd "M-y") 'popup-kill-ring)

Space tabbing

This lets you press the tab key and have it auto indent using spaces instead of tabs

(setq indent-tabs-mode nil)

No more backups

Emacs makes annoying backup files. This gets rid of them

(setq make-backup-files nil)
(setq auto-save-default nil)
(setq create-lockfiles  nil)

Remove all the junk

This gets rid of all the crap (have to watch my language because this is on my github and my github is on my resume) emacs spawns by default

(menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)
(setq inhibit-splash-screen t)


Any yes/no prompts are turned into y/n prompts

(defalias 'yes-or-no-p 'y-or-n-p)


I don’t remember what this does, should have commented it when I added it

(global-subword-mode 1)

Buffer eval

This lets you run the current buffer as elisp code

(global-set-key (kbd "C-S-s") 'eval-buffer)

Gets rid of C-z

C-z does something annoying but I can’t remember what because I got rid of it so long ago

(global-unset-key (kbd "C-z") ) 

Fixes C-k

Allows C-k to kill entire lines instead of just upto the end of the line

(global-set-key (kbd "C-k") 'kill-whole-line)


Helm is really nice for buffer auto completion. This sets it up to be used globally

(use-package helm)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "M-x") 'helm-M-x)
(helm-mode 1)

Switch Window

This is a package that lets you switch windows without using the broken S-<arrow keys> or the really annoying other-window

(use-package switch-window)
(setq switch-window-input-style 'minibuffer)
(setq switch-window-increase 4)
(setq switch-window-threshold 2)
(setq switch-window-shortcut-style 'qwerty)
(global-set-key (kbd "C-x o") 'switch-window)


This is a package that makes finding and replacing not bad

(use-package swiper)
(global-set-key (kbd "C-s") 'swiper)

Expand region

This lets you take the selected region and make it bigger in a logical way

(use-package expand-region)
(global-set-key (kbd "C-q") 'er/expand-region)

Mark multiple

Mark multiple selections that are the same so you can edit them all

(use-package mark-multiple)
(global-set-key (kbd "C-c q") 'mark-next-like-this) 


This is a really useful package that lets you jump around by character

(use-package avy)
(global-set-key (kbd "M-s") 'avy-goto-char)

Create org scratch buffer

(defun org-scratch ()
      (get-buffer-create " *ORG-SCRATCH* ")
  (switch-to-buffer " *ORG-SCRATCH* "))


I use a terminal called ansi-term. It works about as well as any windowed terminal emulator

Ansi-term keybind

This sets up two keybinds, one for tty use and one for exwm use.

(global-set-key (kbd "M-RET") 'ansi-term)
(global-set-key (kbd "<s-return>") 'ansi-term)

Force bash

This forces the terminal to use /bin/bash instead of asking every time

(defvar term-sh "/bin/bash")
(defadvice ansi-term (before force-bash)
  (interactive (list term-sh)))
(ad-activate 'ansi-term)

Custom Functions

Some functionality I had to add for myself. I may move this function around

window splits

This makes it so when you split a window, you jump to the new window

(defun split-and-follow-horizontally ()
  (other-window 1))
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)

(defun split-and-follow-vertically ()
  (other-window 1))
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)

Configuration based keybinds

This lets me edit, reload, and push my configuration in one key

(global-set-key (kbd "C-x c e")
                (lambda()(interactive)(find-file "~/.emacs.d/")))
(global-set-key (kbd "C-x c r")
                  (when (get-buffer "") (save-buffer ""))
                  (org-babel-load-file (expand-file-name "~/.emacs.d/"))))
(global-set-key (kbd "C-x c p")
                  (when (get-buffer "") (save-buffer ""))
                  (magit-call-git "commit" "-m" "Automagitally commited")
                  (magit-call-git "push" "origin")

copy line

This copies a line, killing it without getting rid of it

(global-set-key (kbd "M-k") (lambda()(interactive)


Functionality for programming


Code snippets, these autoexpand and are really nice

(use-package yasnippet)
(use-package yasnippet-snippets)
(yas-global-mode 1)


Auto completion, currently only for elisp but I plan to make it work for other languages as well

(use-package company)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 3)

(add-to-list 'company-backends 'company-elisp)
(add-to-list 'company-backends 'company-clang)

(add-hook 'emacs-lisp-mode-hook 'company-mode)
(add-hook 'c++-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'company-mode)

Sudo edit

Lets you edit a file as root, just by using that keybind in a buffer with that file open

(use-package sudo-edit)
(global-set-key (kbd "C-x M-f") 'sudo-edit)


Package that sorts files into projects based on git projects. Really useful.

(use-package projectile)
(use-package helm-projectile)
(setq projectile-completion-system 'helm)
(define-key projectile-mode-map (kbd "C-x p") 'projectile-command-map)


Git integration for emacs. The defaults are sane so there’s no extra config.

(use-package magit)

Helm tramp

This allows you to use helm to open tramp connections

(use-package helm-tramp)
You can’t perform that action at this time.