Skip to content

Instantly share code, notes, and snippets.

Last active May 27, 2022 07:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Emacs config
(setq gc-cons-threshold 10000000)
;; Restore after startup
(add-hook 'after-init-hook
(lambda ()
(setq gc-cons-threshold 1000000)
(message "gc-cons-threshold restored to %S"
;; package management
(require 'package)
(setq package-archives '(("melpa" . "")
("org" . "")
("elpa" . "")))
(unless package-archive-contents
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(setq load-prefer-newer t)
(require 'use-package)
;; auto install when necessary
(setq use-package-always-ensure t)
;; backups and other internal files should be
(use-package no-littering)
(setq auto-save-file-name-transforms
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p "~/.emacs.d/custom.el")
(load "~/.emacs.d/custom.el"))
(save-place-mode 1)
(setq save-place-file (concat user-emacs-directory "places"))
(setq recentf-save-file (concat user-emacs-directory ".recentf"))
(use-package recentf
:config (recentf-mode 1)
:custom ((recentf-max-menu-items 40)))
;; gui / global
(setq inhibit-startup-screen t)
(tool-bar-mode -1)
(column-number-mode t)
(global-display-line-numbers-mode t)
(size-indication-mode t)
(delete-selection-mode t)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq visible-bell t)
(scroll-bar-mode -1)
(setq-default frame-title-format "%b (%f)")
(global-prettify-symbols-mode +1)
(display-time-mode 1)
(defalias 'yes-or-no-p 'y-or-n-p)
(set-face-attribute 'default nil :font "RobotoMono Nerd Font" :height 100 :weight 'regular)
(set-face-attribute 'bold nil :font "RobotoMono Nerd Font" :height 100 :weight 'bold)
(set-face-attribute 'italic nil :font "BlexMono Nerd Font" :height 100 :weight 'regular :slant 'italic)
(set-fontset-font t 'unicode (font-spec :name "RobotoMono Nerd Font" :size 10) nil)
(use-package unicode-fonts
:custom (unicode-fonts-skip-font-groups '(low-quality-glyphs))
;; :config (unicode-fonts-setup)
(use-package solarized-theme)
(use-package jazz-theme)
(use-package color-theme-sanityinc-tomorrow)
(use-package moe-theme)
;; (setq tsl/light-theme 'solarized-selenized-light)
(setq tsl/light-theme 'tango)
(setq tsl/dark-theme 'jazz)
(use-package doom-themes
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(load-theme tsl/light-theme t)
(setq doom-themes-treemacs-theme "doom-atom")
;; (setq frame-background-mode 'dark)
(use-package all-the-icons)
(use-package doom-modeline
:init (doom-modeline-mode 1)
:custom ((doom-modeline-height 16)
(doom-modeline-buffer-file-name-style 'truncate-all)
(doom-modeline-minor-modes t)))
(use-package which-key
:diminish which-key-mode
:config (which-key-mode)
:custom ((which-key-idle-delay 1.0)
(which-key-enable-extended-define-key t)))
(use-package paredit
:config (paredit-mode 1))
(use-package adjust-parens
:config (adjust-parens-mode 1))
(use-package rainbow-delimiters
:config (rainbow-delimiters-mode 1))
(use-package paren
:custom ((show-paren-delay 0))
(set-face-background 'show-paren-match "#ffaaaa")
(show-paren-mode 1))
(use-package rainbow-mode
(rainbow-mode 1))
(use-package general)
(use-package restart-emacs)
(use-package math-preview
:custom ((math-preview-command "/home/tsl/node_modules/math-preview/math-preview.js")
(math-preview-scale 1.0))
:bind (("C-c m p" . 'math-preview-all)
("C-c m c" . 'math-preview-clear-all)
("C-c m ." . 'math-preview-at-point)
("C-c m /" . 'math-preview-clear-at-point)))
(use-package smex
(use-package ivy
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-use-selectable-prompt t)
(setq ivy-re-builders-alist '((t . ivy--regex-ignore-order))))
;; ivy-prescient removed
(use-package counsel
(counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
(counsel-mode 1))
(use-package ivy-rich
:after ivy
:init (ivy-rich-mode 1))
(use-package expand-region
:bind ("C-@" . er/expand-region))
(use-package multiple-cursors
:bind (("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)
("C-c C-<" . mc/mark-all-like-this)))
(use-package helpful
:commands (helpful-callable helpful-variable helpful-command helpful-key)
(counsel-describe-function-function #'helpful-callable)
(counsel-describe-variable-function #'helpful-variable)
([remap describe-function] . counsel-describe-function)
([remap describe-command] . helpful-command)
([remap describe-variable] . counsel-describe-variable)
([remap describe-key] . helpful-key))
(use-package hydra
:config (require 'hydra))
(use-package ivy-hydra
:after (ivy hydra))
(use-package company
:bind (:map company-active-map
("<tab>" . company-complete-selection))
(company-minimum-prefix-length 1)
(company-idle-delay 0.7)
(global-company-mode 1))
(use-package company-flx
:config (company-flx-mode 1))
(use-package company-box
:hook (company-mode . company-box-mode))
(use-package projectile
:diminish projectile-mode
:config (projectile-mode 1)
:custom ((projectile-completion-system 'ivy)
(projectile-create-missing-test-files t))
("C-c p" . projectile-command-map)
(setq projectile-switch-project-action #'projectile-dired))
(use-package counsel-projectile
:after projectile
:config (counsel-projectile-mode 1))
(use-package project-explorer
:bind (("C-x p" . project-explorer-toggle)))
(use-package magit
:commands magit-status)
(use-package dired
:ensure nil
:commands (dired dired-jump)
:bind (("C-x C-j" . dired-jump))
:custom ((dired-listing-switches "-agho --group-directories-first")))
(use-package dired-single
:commands (dired dired-jump))
(use-package dired-ranger)
(use-package dired-collapse)
(use-package dired-rainbow)
(use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode))
(use-package all-the-icons-ivy-rich)
(use-package uniquify
:ensure nil
(setq uniquify-buffer-name-style 'post-forward))
(use-package yasnippet
:config (yas-global-mode 1))
(use-package ivy-yasnippet)
(use-package ace-window
:bind (("M-]" . ace-window))
:config (ace-window-display-mode 1))
(use-package paradox
:config (paradox-enable))
(use-package anzu
:config (global-anzu-mode 1))
(use-package move-text
(use-package aggressive-indent)
(use-package diminish)
(use-package minions
:config (minions-mode 1))
(use-package default-text-scale
:config (default-text-scale-mode))
(use-package virtual-comment)
;; R
(use-package ess)
(use-package poly-R)
;; treemacs
(use-package treemacs-all-the-icons)
(use-package treemacs)
(use-package treemacs-projectile)
(use-package treemacs-magit)
;; clojure
(use-package flycheck)
(use-package flycheck-clj-kondo)
(use-package clojure-mode
(require 'flycheck-clj-kondo)
(use-package cider
:custom ((cider-eldoc-display-for-symbol-at-point nil)
(cider-eldoc-display-context-dependent-info t)
(cider-repl-pop-to-buffer-on-connect 'display-only)
(cider-overlays-use-font-lock t)
(cider-repl-buffer-size-limit 60000)))
(use-package clj-refactor)
(use-package clojure-mode-extra-font-locking)
(use-package sayid)
(use-package cljr-ivy)
(use-package clojure-snippets)
(use-package ivy-clojuredocs
:bind (:map clojure-mode-map
(("C-c d" . ivy-clojuredocs-at-point))))
(use-package clj-decompiler)
;; lsp
(use-package lsp-mode
:hook ((clojure-mode . lsp))
:custom ((lsp-lens-enable t)
(lsp-enable-indentation nil)
(read-process-output-max (* 1024 1024))
(lsp-clojure-custom-server-command '("/usr/local/bin/clojure-lsp"))
(lsp-keymap-prefix "C-c l"))
:config (dolist (m '(clojure-mode
(add-to-list 'lsp-language-id-configuration `(,m . "clojure")))
;; (use-package lsp-ui :commands lsp-ui-mode)
;; (use-package lsp-treemacs)
;; (use-package lsp-ivy)
;; (use-package consult-lsp)
(use-package iedit
:bind (("C-c ;" . iedit-mode)) )
(use-package nov
:custom ((nov-text-width 80))
:config (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
(global-prettify-symbols-mode +1)
(autoload 'iimage-mode "iimage" "Support Inline image minor mode." t)
(autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." t)
(autoload 'zap-up-to-char "misc"
"Kill up to, but not including ARGth occurrence of CHAR." t)
(defun toggle-comment-on-line ()
"comment or uncomment current line"
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))
(defun prev-window ()
(other-window -1))
"M-z" 'zap-up-to-char
"C-<tab>" 'indent-relative
"C-x C-b" 'counsel-ibuffer
"C-s" 'swiper
"C-r" 'isearch-backward-regexp
"C-M-s" 'isearch-forward
"C-M-r" 'isearch-backwatdrd
"C-." 'company-complete
"C-c t l" (lambda () (interactive) (load-theme tsl/light-theme t))
"C-c t d" (lambda () (interactive) (load-theme tsl/dark-theme t))
"C-;" 'toggle-comment-on-line
"C-M-<next>" 'other-window
"C-M-<prior>" 'prev-window)
(add-hook 'prog-mode-hook (lambda () (setq indent-tabs-mode nil)))
(add-hook 'prog-mode-hook 'rainbow-mode)
(add-hook 'prog-mode-hook 'paredit-mode)
(add-hook 'prog-mode-hook 'eldoc-mode)
(add-hook 'prog-mode-hook 'adjust-parens-mode)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(add-hook 'prog-mode-hook 'show-paren-mode)
(add-hook 'prog-mode-hook 'subword-mode)
(add-hook 'prog-mode-hook 'hs-minor-mode)
(add-hook 'prog-mode-hook 'aggressive-indent-mode)
(add-hook 'prog-mode-hook 'turn-on-iimage-mode)
(add-hook 'clojure-mode-hook 'flycheck-mode)
(add-hook 'clojure-mode-hook
(lambda ()
(push '("defn" . ?Λ) prettify-symbols-alist)
(push '("def" . ?≡) prettify-symbols-alist)))
(add-hook 'clojure-mode-hook 'cider-mode)
(add-hook 'clojure-mode-hook (lambda ()
(eval-after-load 'cider
(require 'clj-decompiler)
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-m")))))
;; When there's a cider error, show its buffer and switch to it
(setq cider-show-error-buffer t)
(setq cider-auto-select-error-buffer t)
;; Where to store the cider history.
(setq cider-repl-history-file "~/.emacs.d/cider-history")
;; Wrap when navigating history.
(setq cider-repl-wrap-history t)
;; add sayid :/
(setq cider-clojure-cli-aliases ":dev")
(cider-add-to-alist 'cider-jack-in-dependencies
"com.billpiel/sayid" "0.1.0")
;; Use clojure mode for other extensions
(add-to-list 'auto-mode-alist '("\\.edn$" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.boot$" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.cljs.*$" . clojure-mode))
(eval-after-load 'clojure-mode '(sayid-setup-package))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment