diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2019-09-14 18:09:53 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2020-04-12 17:07:25 -0500 |
commit | cb56e48805ae897d9fab5a269adbb817fdf42223 (patch) | |
tree | c73cb420d0d1cf73886a4ad4deb5a77a3bcfd8eb /emacs | |
parent | ffef92f12b3b0273c0a652459573d64d3d586e6e (diff) |
emacs: major rewrite of config
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs | 37 | ||||
-rw-r--r-- | emacs/.emacs.d/colors.el | 1 | ||||
-rw-r--r-- | emacs/.emacs.d/custom.el | 22 | ||||
-rw-r--r-- | emacs/.emacs.d/init.el | 185 | ||||
-rw-r--r-- | emacs/.emacs.d/org-mode.el | 76 | ||||
-rw-r--r-- | emacs/.emacs.d/treemacs.el | 3 |
6 files changed, 207 insertions, 117 deletions
diff --git a/emacs/.emacs b/emacs/.emacs deleted file mode 100644 index 8769d6f..0000000 --- a/emacs/.emacs +++ /dev/null @@ -1,37 +0,0 @@ -(defconst user-init-dir - (cond ((boundp 'user-emacs-directory) user-emacs-directory) - ((boundp 'user-init-directory) user-init-directory) - (t "~/.emacs.d"))) - -(defun load-user-file (file) - "Load a file in current user's configuration directory" - (load (expand-file-name file user-init-dir) t nil t)) - -; These lines must come first, before `(package-initialize)` -(require 'package) -(add-to-list 'package-archives (cons "melpa" "https://melpa.org/packages/") t) - -(package-initialize) - -(load-user-file "org-mode.el") -(load-user-file "treemacs.el") -(load-user-file "colors.el") - -(setq-default c-default-style "linux" - c-basic-offset 4 - tab-width 4 - indent-tabs-mode t) - -(custom-set-variables - '(package-selected-packages - (quote - (treemacs - ample-theme - color-theme-sanityinc-tomorrow - material-theme - subatomic-theme - subatomic256-theme - )))) - -(custom-set-faces - '(default ((t (:family "Inconsolata" :foundry "PfEd" :slant normal :weight normal :height 140 :width normal))))) diff --git a/emacs/.emacs.d/colors.el b/emacs/.emacs.d/colors.el deleted file mode 100644 index 4039956..0000000 --- a/emacs/.emacs.d/colors.el +++ /dev/null @@ -1 +0,0 @@ -(load-theme 'sanityinc-tomorrow-blue t) diff --git a/emacs/.emacs.d/custom.el b/emacs/.emacs.d/custom.el new file mode 100644 index 0000000..127a759 --- /dev/null +++ b/emacs/.emacs.d/custom.el @@ -0,0 +1,22 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(custom-enabled-themes (quote (dracula))) + '(custom-safe-themes + (quote + ("63df625509cec7b2b7deba1d48ef07ffbee99c735a95d130ad9d1fc3df8b9a34" "55c2069e99ea18e4751bd5331b245a2752a808e91e09ccec16eb25dadbe06354" "5f1bd7f67dc1598977e69c6a0aed3c926f49581fdf395a6246f9bc1df86cb030" "6731049cee8f7cbd542d7b3e1c551f3fab716a92119bd7c77f0bd1ef20849fb8" "28caf31770f88ffaac6363acfda5627019cac57ea252ceb2d41d98df6d87e240" "947190b4f17f78c39b0ab1ea95b1e6097cc9202d55c73a702395fc817f899393" "35b0b0e531731e270708ddb342dc2e576a31fb298dcbc56a206596a43afac54f" "274fa62b00d732d093fc3f120aca1b31a6bb484492f31081c1814a858e25c72e" default))) + '(package-selected-packages + (quote + (doom-themes counsel-projectile ivy slime neotree magit all-the-icons centaur-tabs company-quickhelp lsp-ui yasnippet typescript-mode company-lsp company-posframe company-c-headers telephone-line dracula-theme evil use-package)))) + +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(default ((t (:family "Iosevka Term Slab" :foundry "CYEL" :slant normal :weight light :height 128 :width normal)))) + '(hl-line ((t (:background "gray8")))) + '(line-number ((t (:inherit (shadow default) :background "gray16")))) + '(line-number-current-line ((t (:inherit line-number :background "gray20" :foreground "dark orange" :slant italic))))) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el new file mode 100644 index 0000000..f73b395 --- /dev/null +++ b/emacs/.emacs.d/init.el @@ -0,0 +1,185 @@ +;; --- 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)) + +;; --- 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-<prior>" . centaur-tabs-backward) + ("C-<next>" . centaur-tabs-forward)) + +;; --- FILE TREE --- +(use-package neotree + :config + (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) + :bind + ("<f8>" . 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 + ;; -- 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))) + +(setq custom-file "~/.emacs.d/custom.el") +(load-file custom-file) diff --git a/emacs/.emacs.d/org-mode.el b/emacs/.emacs.d/org-mode.el deleted file mode 100644 index 1828b38..0000000 --- a/emacs/.emacs.d/org-mode.el +++ /dev/null @@ -1,76 +0,0 @@ -(require 'org-install) - -; initialize these to empty lists so config files we reference can use 'add-to-list', -; rather than replacing the whole list and possibly trampling on another config file. -(setq org-agenda-files ()) -(setq org-capture-templates ()) -(setq org-tag-faces ()) - -(load-user-file "org-mode.local.el") - -(add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) -(add-to-list 'auto-mode-alist `(,(expand-file-name "~/org/") . org-mode)) - -(define-key mode-specific-map [?a] 'org-agenda) - -(eval-after-load "org" - '(progn - (define-prefix-command 'org-todo-state-map) - - (define-key org-mode-map "\C-cx" 'org-todo-state-map) - - (define-key org-todo-state-map "x" #'(lambda nil (interactive) (org-todo "CANCELLED"))) - (define-key org-todo-state-map "d" #'(lambda nil (interactive) (org-todo "DONE"))) - (define-key org-todo-state-map "f" #'(lambda nil (interactive) (org-todo "DEFERRED"))) - (define-key org-todo-state-map "l" #'(lambda nil (interactive) (org-todo "DELEGATED"))) - (define-key org-todo-state-map "s" #'(lambda nil (interactive) (org-todo "STARTED"))) - (define-key org-todo-state-map "w" #'(lambda nil (interactive) (org-todo "WAITING"))))) - -(define-key global-map "\C-cc" 'org-capture) - -(custom-set-variables - '(org-agenda-custom-commands - '(("h" "Home agenda" - ((agenda "") - (alltodo "" - ((org-agenda-skip-function '(org-agenda-skip-if nil '(scheduled deadline))) - (org-agenda-overriding-header "Eventual TODO items:")))) - ((org-agenda-tag-filter-preset '("+home")))) - ("j" "Work agenda" - ((agenda "") - (alltodo "" - ((org-agenda-skip-function '(org-agenda-skip-if nil '(scheduled deadline))) - (org-agenda-overriding-header "Eventual TODO items:")))) - ((org-agenda-tag-filter-preset '("-home")))) - ("w" todo "WAITING" nil) - ("W" agenda "" ((org-agenda-ndays 21))) - ("A" agenda "" - ((org-agenda-skip-function - (lambda nil - (org-agenda-skip-entry-if - (quote notregexp) - "\\=.*\\[#!\\]"))) - (org-agenda-ndays 1) - (org-agenda-overriding-header "Today's Priority #A tasks: "))) - ("u" alltodo "" - ((org-agenda-skip-function - (lambda nil - (org-agenda-skip-entry-if - (quote scheduled) - (quote deadline) - (quote regexp) - " -]+>")) - (org-agenda-overriding-header "Unscheduled TODO entries: ")))))) - '(org-agenda-dim-blocked-tasks 'invisible) - '(org-agenda-ndays 14) - '(org-agenda-show-all-dates t) - '(org-agenda-skip-deadline-if-done t) - '(org-agenda-skip-deadline-prewarning-if-scheduled t) - '(org-agenda-skip-scheduled-if-done t) - '(org-agenda-start-on-weekday nil) - '(org-deadline-warning-days 14) - '(org-enforce-todo-dependencies t) - '(org-fast-tag-selection-single-key (quote expert)) - '(org-return-follows-link t) - '(org-reverse-note-order t)) diff --git a/emacs/.emacs.d/treemacs.el b/emacs/.emacs.d/treemacs.el deleted file mode 100644 index 5117b71..0000000 --- a/emacs/.emacs.d/treemacs.el +++ /dev/null @@ -1,3 +0,0 @@ -(global-set-key (kbd "M-0") 'treemacs-select-window) -(global-set-key (kbd "C-x t t") 'treemacs) - |