;; --- FUNCTIONS --- (defun load-if-exists (filename) (when (file-exists-p filename) (load-file filename))) ;; --- BUG WORKAROUNDS --- ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341 ;; Affects ability to use the gnu package repository on gnutls 3.6. ;; Should recheck when emacs >26 is out. (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") ;; https://stackoverflow.com/questions/26108655/ ;; https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-12/msg00781.html ;; Apparently the gnu package repository has had unverifiable ;; signatures since 2014 and nobody cares ¯\_(ツ)_/¯ (setq package-check-signature nil) ;; --- TERMINAL SUPPORT --- (add-to-list 'term-file-aliases '("st-256color" . "tmux-256color")) ;; --- PACKAGE REPOSITORIES --- (require 'package) (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) (package-initialize) (require 'use-package) (require 'whitespace) (require 'yasnippet) (require 'evil) ;; --- GLOBAL MODES --- (evil-mode 1) ;; Make emacs usable (global-hl-line-mode 1) ;; Highlight the line containing the cursor (global-whitespace-mode 1) ;; Display whitespace, highlight trailing whitespace (show-paren-mode 1) ;; Highlight matching parenthesis (use-package ivy :config (setq ivy-use-virtual-buffers t enable-recursive-minibuffers t) (ivy-mode 1)) ;; --- ORG MODE --- (use-package org-ql :demand t :mode (("\\.org$" . org-mode)) :init (add-to-list 'auto-mode-alist `(,(expand-file-name "~/org/") . org-mode)) :bind (("C-c a" . bab/org-agenda)) :config (load-file "~/.emacs.d/org-mode.el") (load-if-exists "~/.emacs.d/org-mode.local.el")) ;; --- PROJECTS --- (use-package projectile :demand t :config (setq projectile-completion-system 'ivy) (projectile-mode 1) :bind-keymap ("C-c p" . projectile-command-map)) (use-package counsel-projectile :config (counsel-projectile-mode 1) :after (ivy projectile)) ;; --- TABS --- (use-package all-the-icons) (use-package centaur-tabs :demand :config (setq centaur-tabs-set-bar 'over centaur-tabs-set-icons t centaur-tabs-modified-marker t centaur-tabs-height 32 centaur-tabs-icon-v-adjust -0.15) (centaur-tabs-change-fonts "Iosevka Regular" 120) (centaur-tabs-mode t) :bind ("C-" . centaur-tabs-backward) ("C-" . centaur-tabs-forward)) ;; --- FILE TREE --- (use-package neotree :config (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) :bind ("" . neotree-toggle)) ;; --- AUTO-COMPLETE --- (use-package company :config (global-company-mode) (require 'color) (let ((bg "midnight blue")) (set-face-attribute 'company-tooltip nil :background bg) (set-face-attribute 'company-scrollbar-bg nil :background (color-lighten-name bg 20)) (set-face-attribute 'company-scrollbar-fg nil :background (color-lighten-name bg 40))) ) (use-package company-posframe :after company :config (setq company-posframe-show-indicator nil company-posframe-quickhelp-delay nil) (company-posframe-mode 1) ) (use-package company-c-headers :after company :config (push 'company-c-headers company-backends)) (use-package company-lsp :after company :config (push 'company-lsp company-backends)) ;; --- LANGUAGE SERVERS --- (use-package lsp-mode :hook (typescript-mode . lsp-deferred) :commands (lsp lsp-deferred)) (use-package lsp-ui :hook (lsp-mode . lsp-ui-mode)) (use-package company-lsp :commands company-lsp) ;; --- TODO --- ;;(require 'undo-tree) ;; --- POWERLINE --- (require 'telephone-line) (telephone-line-mode 1) ;; --- INDENTATION --- ;; Two callable functions for enabling/disabling tabs in Emacs (defun disable-tabs () (setq indent-tabs-mode nil)) (defun enable-tabs () (local-set-key (kbd "TAB") 'tab-to-tab-stop) (setq indent-tabs-mode t)) ;; Hooks to Enable Tabs (add-hook 'prog-mode-hook 'enable-tabs) ;; Hooks to Disable Tabs ;; Using tabs in lisp just leads to mixing tabs and spaces, which is yucky (add-hook 'lisp-mode-hook 'disable-tabs) (add-hook 'emacs-lisp-mode-hook 'disable-tabs) ;; --- GENERAL PREFERENCES --- (setq-default ;; --- THEME CONFIGURATION --- dracula-enlarge-headings nil ;; -- TABS AND INDENTATION -- ;; Set tab stops to every four spaces tab-width 4 ;; Tab key indents if cursor at start of line, otherwise inserts tab character tab-always-indent nil ;; Backspace deletes one whole tab character backward-delete-char-untabify-method nil ;; --- MOUSE --- ;; Don't speed up during continued mouse wheel scrolling mouse-wheel-progressive-speed nil ;; -- C LANGUAGE -- ;; Overall tab and brace placement style c-default-style "linux" ;; Indent width c-basic-offset 4 ;; -- LISP -- inferior-lisp-program "sbcl" ;; -- WHITESPACE -- ;; Clean up trailing whitespace automatically on save whitespace-action '(auto-cleanup) ;; Configure what to highlight. ;; Main difference from default is that for overlong lines, ;; we only highlight the overlong tail, not the whole line whitespace-style '(face trailing tabs spaces lines-tail empty indentation space-after-tab space-before-tab space-mark tab-mark) ;; -- MISC -- ;; Display line numbers, relative to the current line display-line-numbers 'relative ;; Don't show the emacs startup screen inhibit-startup-screen t ) (let ((fg "RoyalBlue4") (bg 'unspecified) (faces '(whitespace-hspace whitespace-newline whitespace-space whitespace-tab))) (dolist (face faces) (set-face-attribute face nil :foreground fg :background bg))) (load-if-exists "~/.emacs.d/local.el") (setq custom-file "~/.emacs.d/custom.el") (load-file custom-file)