diff --git a/apply.sh b/apply.sh index ad236c3..a1c4633 100755 --- a/apply.sh +++ b/apply.sh @@ -14,6 +14,9 @@ rsync -a alacritty/ "$CONFIG_DIR/alacritty" echo "Copying picom config..." rsync -a picom/ "$CONFIG_DIR/picom" +echo "Copying emacs config..." +rsync -a emacs/ "/home/alex/.emacs.d" + echo "Copying rofi config..." cp rofi/config.rasi "$CONFIG_DIR/rofi" cp rofi/theme.rasi "$CONFIG_DIR/rofi" diff --git a/emacs/init.el b/emacs/init.el new file mode 100644 index 0000000..f0cade8 --- /dev/null +++ b/emacs/init.el @@ -0,0 +1,156 @@ +;; Disable UI elements +(setq inhibit-splash-screen t) +(menu-bar-mode -1) +(toggle-scroll-bar -1) +(tool-bar-mode -1) + +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) +(package-initialize) +(package-refresh-contents) + +(when (not (package-installed-p 'use-package)) + (package-install 'use-package)) + +;; Add personal elisp lib dir +(add-to-list 'load-path "~/.emacs.d/lisp/") + +;; Auto refresh buffers if the file has been changed on disk +(global-auto-revert-mode t) + +;; Theme +(use-package gruvbox-theme) + +;; Set the font size +(set-face-attribute 'default nil :height 140) + +;; Nov.el +(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) + +;; Org Mode configs +(require 'org) +(define-key global-map "\C-cl" 'org-store-link) +(define-key global-map "\C-ca" 'org-agenda) +(setq org-hide-emphasis-markers t) +(setq org-log-done t) +(setq org-agenda-files (list "~/Journal")) +(setq org-todo-keywords + '((sequence "TODO" "NEXT" "STARTED" "|" "DONE"))) + +(font-lock-add-keywords 'org-mode + '(("^ *\\([-]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) + +(setq-default fill-column 80) +(add-hook 'org-mode-hook 'visual-line-mode) +(add-hook 'org-mode-hook (lambda () (set-fill-column 95))) +(add-hook 'org-mode-hook 'visual-fill-column-mode) +(add-hook 'org-mode-hook + (lambda () + (org-indent-mode t)) + t) + +(use-package org-bullets + :config + (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) + +(let* ((variable-tuple + (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro")) + ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande")) + ((x-list-fonts "Verdana") '(:font "Verdana")) + ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) + (nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro.")))) + (base-font-color (face-foreground 'default nil 'default)) + (headline `(:inherit default))) + + (custom-theme-set-faces + 'user + '(org-indent ((t (:inherit (org-hide fixed-pitch))))) + `(org-level-8 ((t (,@headline ,@variable-tuple)))) + `(org-level-7 ((t (,@headline ,@variable-tuple)))) + `(org-level-6 ((t (,@headline ,@variable-tuple)))) + `(org-level-5 ((t (,@headline ,@variable-tuple)))) + `(org-level-4 ((t (,@headline ,@variable-tuple)))) + `(org-level-3 ((t (,@headline ,@variable-tuple)))) + `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.05)))) + `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.12)))) + `(org-document-title ((t (,@headline ,@variable-tuple :height 1.25 :underline nil)))))) + +(custom-theme-set-faces + 'user + '(variable-pitch ((t (:family "Source Sans Pro" :height 180 :weight light)))) + '(fixed-pitch ((t ( :family "Inconsolata" :slant normal :weight normal :height 1.0 :width normal))))) + +(require 'ob-java) +(add-to-list 'org-babel-load-languages '(java . t)) + +;; Configure Language Server Protocol +(require 'lsp-mode) +(require 'dap-mode) +(require 'company-lsp) +(require 'lsp-ui) +(require 'lsp-treemacs) +(require 'lsp-java) +(require 'rust-mode) +(add-hook 'java-mode-hook #'lsp) + +;; Configure hoon mode +(load "hoon-mode") +(add-hook 'hoon-mode + (lambda () + (define-key hoon-mode-map (kbd "C-c r") 'hoon-eval-region-in-herb) + (define-key hoon-mode-map (kbd "C-c b") 'hoon-eval-buffer-in-herb))) +(add-hook 'hoon-mode #'lsp) +(add-to-list 'auto-mode-alist '("\\.hoon\\'" . hoon-mode)) + +;; Automatically open some files in a buffer +(require 'treemacs) +(treemacs) +(find-file "/home/alex/.emacs.d/init.el") +(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. + '(ido-mode 'both nil (ido)) + '(markdown-code-lang-modes + '(("ocaml" . tuareg-mode) + ("elisp" . emacs-lisp-mode) + ("ditaa" . artist-mode) + ("asymptote" . asy-mode) + ("dot" . fundamental-mode) + ("sqlite" . sql-mode) + ("calc" . fundamental-mode) + ("C" . c-mode) + ("cpp" . c++-mode) + ("C++" . c++-mode) + ("screen" . shell-script-mode) + ("shell" . sh-mode) + ("bash" . sh-mode) + ("html" . html-mode))) + '(org-export-backends '(ascii html icalendar latex md odt)) + '(org-export-with-toc nil) + '(org-tag-faces nil) + '(org-tags-column 0) + '(package-selected-packages + '(rust-mode yaml-mode visual-fill-column nov use-package org-bullets lsp-ui lsp-java htmlize gruvbox-theme flycheck-rust dap-mode company-lsp))) +(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. + '(fixed-pitch ((t (:family "Inconsolata" :slant normal :weight normal :height 1.0 :width normal)))) + '(markdown-code-face ((t (:family "Monospace")))) + '(org-document-title ((t (:inherit default :font "Verdana" :height 1.25 :underline nil)))) + '(org-indent ((t (:inherit (org-hide fixed-pitch))))) + '(org-level-1 ((t (:inherit default :font "Verdana" :height 1.12)))) + '(org-level-2 ((t (:inherit default :font "Verdana" :height 1.05)))) + '(org-level-3 ((t (:inherit default :font "Verdana")))) + '(org-level-4 ((t (:inherit default :font "Verdana")))) + '(org-level-5 ((t (:inherit default :font "Verdana")))) + '(org-level-6 ((t (:inherit default :font "Verdana")))) + '(org-level-7 ((t (:inherit default :font "Verdana")))) + '(org-level-8 ((t (:inherit default :font "Verdana")))) + '(org-tag ((((class color) (min-colors 16777215)) (:foreground "rosy brown" :bold t :weight bold)) (((class color) (min-colors 255)) (:bold t :weight bold)))) + '(org-tag-group ((t (:inherit org-tag :foreground "lawn green")))) + '(variable-pitch ((t (:family "Source Sans Pro" :height 180 :weight light)))))