summaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/init.el
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2019-09-14 18:09:53 -0500
committerBobby Bingham <koorogi@koorogi.info>2020-04-12 17:07:25 -0500
commitcb56e48805ae897d9fab5a269adbb817fdf42223 (patch)
treec73cb420d0d1cf73886a4ad4deb5a77a3bcfd8eb /emacs/.emacs.d/init.el
parentffef92f12b3b0273c0a652459573d64d3d586e6e (diff)
emacs: major rewrite of config
Diffstat (limited to 'emacs/.emacs.d/init.el')
-rw-r--r--emacs/.emacs.d/init.el185
1 files changed, 185 insertions, 0 deletions
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)