;; set up straight.el (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) ;; set a bunch of varibles (setq user-full-name "d_m" user-mail-address "d_m@plastic-idolatry.com" straight-use-package-by-default t package-enable-at-startup nil straight-vc-git-default-protocol 'https load-path (cons "~/.emacs-new.d/lisp" load-path) inhibit-startup-screen t org-directory "~/org/" line-move-visual nil create-lockfiles nil make-backup-files nil column-number-mode t scroll-error-top-bottom t show-paren-delay 0.5 column-number-mode t diff-switches "-u" large-file-warning-threshold nil sentence-end-double-space nil mode-line-compact nil company-idle-delay nil company-tooltip-idle-delay nil dired-kill-when-opening-new-dired-buffer t read-minibuffer-restore-windows t frame-background-mode 'dark) ;; turn off UI various gizmos (set-face-attribute 'mode-line nil :box nil) (when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) (when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (when (fboundp 'menu-bar-mode) (menu-bar-mode -1)) (blink-cursor-mode 0) ;; install icons (use-package all-the-icons :if (display-graphic-p)) ;; show function names in modeline (which-function-mode t) ;; use utf-8 (prefer-coding-system 'utf-8) ;; UI settings when not in a terminal (when (display-graphic-p) (setq mac-option-key-is-meta nil mac-command-key-is-meta t mac-command-modifier 'meta mac-option-modifier nil x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) (set-frame-font "PragmataPro Liga 28" nil t) (set-foreground-color "#c7c7c7") (set-background-color "#000000")) ;; set up font ligatures (use-package pragmatapro-lig :straight (pragmatapro-lig :type git :host github :repo "lumiknit/emacs-pragmatapro-ligatures") :config (add-hook 'prog-mode-hook 'pragmatapro-lig-mode)) ;; line numbers (global-display-line-numbers-mode t) (setq display-line-numbers "%4d ") ;; allow y or n instead of yes or no (fset 'yes-or-no-p 'y-or-n-p) ;; C-x p to get back to mark (bind-key "C-x p" 'pop-to-mark-command) (setq set-mark-command-repeat-pop t) ;; work with multiple files not in same directory (require 'find-dired) (setq find-ls-option '("-print0 | xargs -0 ls -ld" . "-ld")) ;; hippie expand stuff: M-/ to expand things (bind-key "M-/" 'hippie-expand) (defun sanityinc/dabbrev-friend-buffer (other-buffer) (< (buffer-size other-buffer) (* 1 1024 1024))) (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer) (setq hippie-expand-try-functions-list '(try-expand-all-abbrevs try-complete-file-name-partially try-complete-file-name try-expand-dabbrev try-expand-dabbrev-from-kill try-expand-dabbrev-all-buffers try-expand-list try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol)) ;; comment regions using C-c # (uncomment with C-u C-c #) (global-set-key "\C-c#" 'comment-region) (setq comment-empty-lines nil) ;; indent regions using C-c > and C-c < (global-set-key "\C-c>" 'indent-region) (global-set-key "\C-c<" 'unindent-region) ;; use M-g to go to a certain line (global-set-key "\M-g" 'goto-line) ;; use M-$ to do query-replace-regexp (global-set-key "\M-$" 'query-replace-regexp) ;; modes (electric-indent-mode 0) ;; global keybindings (global-unset-key (kbd "C-z")) ; synchronize emacs exec-path and $PATH (use-package exec-path-from-shell :config (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize))) ;; rainbow delimiters (use-package rainbow-delimiters) ;; distraction free writing (use-package writeroom-mode) ;; C-c restore old buffer view after popups (use-package winner :config (winner-mode 1)) ;; compact mode line (use-package smart-mode-line) ;; various modes that might come in handy (use-package markdown-mode) (use-package racket-mode) (use-package tuareg) (use-package forth-mode) ;; scala-mode (use-package scala-mode :mode "\\.s\\(cala\\|bt\\)$" :interpreter ("scala" . scala-mode) :config (setq scala-indent:indent-value-expression nil scala-indent:align-parameters nil scala-indent:align-forms nil scala-indent:use-javadoc-style t)) ;; ;; Enable nice rendering of diagnostics like compile errors. ;; (use-package flycheck ;; :init (global-flycheck-mode)) ;; ;; (use-package lsp-mode ;; :ensure t) ;; ; :init (setq lsp-prefer-flymake nil)) ;; ;; (use-package lsp-ui ;; :ensure t ;; :hook (lsp-mode . lsp-ui-mode)) ;; ;; (use-package lsp-scala ;; :after scala-mode ;; :demand t ;; ; :hook (scala-mode . lsp) ;; :init (setq lsp-scala-server-command "~/bin/metals-emacs")) ;; projectile (use-package projectile :demand :init (setq projectile-use-git-grep t) ;;;:config (projectile-global-mode t) :bind (("C-c C-f" . projectile-find-file) ("C-c C-g" . projectile-ripgrep))) ;; ripgrep (use-package rg) ;; ido (use-package flx-ido :demand :init (setq ido-show-dot-for-dired nil ido-enable-dot-prefix nil ido-use-faces t) :config (ido-mode 1) (ido-everywhere 1) (flx-ido-mode 1)) ;; highlight-symbol (use-package highlight-symbol :diminish highlight-symbol-mode :commands highlight-symbol :bind ("s-h" . highlight-symbol)) ;; popup-imenu (use-package popup-imenu :commands popup-imenu :bind ("M-i" . popup-imenu)) ;; magit (use-package magit :commands magit-status magit-blame :init (setq magit-revert-buffers nil) :bind (("C-x g" . magit-status) ("s-b" . magit-blame))) ;; org roam (use-package org-roam :custom (org-roam-directory "~/org/")) ;; git-gutter (use-package git-gutter :config (global-git-gutter-mode t) (set-face-foreground 'git-gutter:modified "orange") (set-face-foreground 'git-gutter:added "green") (set-face-foreground 'git-gutter:deleted "red") (setq git-gutter:handled-backends '(git hg svn)) (global-set-key (kbd "C-x n") 'git-gutter:next-hunk)) ;; git-timemachine (use-package git-timemachine :config (add-hook 'git-timemachine-mode-hook (lambda () (ensime-mode 0)))) ;; json (use-package json-mode) ;; glauce (require 'glauce-mode) ;; uxntal (use-package uxntal-mode :straight (uxntal-mode :type git :host github :repo "non/uxntal-mode") :bind ("C-c d" . uxntal-explain-word) :config (setq uxntal-mode-strict-comments nil)) ;; C-c C-c for M-x compile (global-set-key "\C-c\C-c" 'compile) ;; bazel (use-package bazel :straight (bazel :type git :host github :repo "bazelbuild/emacs-bazel-mode") :bind ("C-c C-b" . bazel-build) :config (setq bazel-command '("/usr/local/bin/bazel"))) ;; thrift (use-package thrift-mode :straight (thrift-mode :type git :host github :repo "davidmiller/thrift-mode") :config (add-to-list 'auto-mode-alist '("\\.thrift\\'" . thrift-mode))) ;; use doom themes )) (use-package doom-themes )) :straight (doom-themes :type git )) :host github )) :repo "doomemacs/themes") )) :config (load-theme 'doom-badger t) )) (doom-themes-neotree-config) )) (setq doom-themes-treemacs-theme "doom-colors") )) (doom-themes-treemacs-config) )) (doom-themes-org-config)) )) ;; try using a fancier mode line (use-package doom-modeline :ensure t :init (doom-modeline-mode 1) :config (setq doom-modeline-height 1 doom-modeline-buffer-file-name-style 'truncate-with-project ;doom-modeline-buffer-file-name-style 'relative-to-project doom-modeline-buffer-encoding nil) (display-battery-mode 1)) ;;; turn off branch in mode line for now ;(setq vc-handled-backends nil) ;; force vc to update branches, etc. (unused for now) (defun force-update-vcs () "Update vc in all verson-controlled buffers" (interactive) (dolist (buf (buffer-list)) (with-current-buffer buf (vc-refresh-state)))) ;; playing music in emacs (use-package emms :config (setq emms-source-file-default-directory "~/bandcamp/" emms-browser-covers 'emms-browser-cache-thumbnail-async scroll-up-aggressively 0.0 scroll-down-aggressively 0.0 emms-playlist-buffer-name "*Music*") (emms-all) (emms-default-players)) ;; browsing gemini/gopher sites in emacs (use-package elpher :config (setq elpher-default-url-type "gemini://")) ;; local copy in .emacs.d/lisp (require 'etags-select) ;; don't case fold for ctags (setq tags-case-fold-search nil) ;; whitespace stuff (require 'whitespace) (global-whitespace-mode t) (setq whitespace-style '(newline tab-mark)) (setq-default indent-tabs-mode nil tab-width 4 c-basic-offset 4 show-trailing-whitespace t) ;; handy function to toggle tabs (defun toggle-indent-tabs () "Toggle tabs on/off" (interactive) (setq indent-tabs-mode (if (indent-tabs-mode) nil t))) ;; handy function to regenerate tags (defun regenerate-tags () "regenerate-tags" (interactive) (defun runloop (dir) (let ((tagfile (concat dir "TAGS"))) (if (file-exists-p tagfile) (let ((default-directory dir)) (progn (shell-command "echo generating tags...") (async-shell-command "ets"))) (progn (let ((next (file-name-directory (directory-file-name dir)))) (if (equal dir next) (shell-command "uptime") (runloop next))))))) (runloop default-directory)) (global-set-key (kbd "C-t") 'regenerate-tags) ;; spell checking as you type in text-mode (autoload 'flyspell-mode-on "flyspell" "On-the-fly ispell." t) (add-hook 'text-mode-hook 'flyspell-mode-on) ;; use nicer diff colors (defun update-diff-colors () "update the colors for diff faces" (set-face-foreground 'diff-added "green") (set-face-foreground 'diff-removed "red") (set-face-foreground 'diff-changed "purple")) (eval-after-load "diff-mode" '(update-diff-colors))