dotfiles/emacs/init.el

136 lines
4.4 KiB
EmacsLisp
Raw Normal View History

2022-01-09 22:31:01 +00:00
;; 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))
2022-01-10 00:49:31 +00:00
(require 'use-package)
(setq use-package-always-ensure t)
2022-01-09 22:31:01 +00:00
;; 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
2022-01-10 00:49:31 +00:00
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
2022-01-09 22:31:01 +00:00
(use-package gruvbox-theme)
2022-01-10 00:49:31 +00:00
(load-theme 'gruvbox t)
2022-01-09 22:31:01 +00:00
;; 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
2022-01-10 00:49:31 +00:00
(use-package lsp-mode)
(use-package dap-mode)
(use-package company)
(use-package lsp-ui)
(use-package lsp-treemacs)
(use-package lsp-java)
(use-package rust-mode)
2022-01-09 22:31:01 +00:00
(add-hook 'java-mode-hook #'lsp)
;; Automatically open some files in a buffer
2022-01-10 00:49:31 +00:00
(use-package treemacs
:ensure t
:defer t)
2022-01-09 22:31:01 +00:00
(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
2022-01-10 00:49:31 +00:00
'(rust-mode yaml-mode visual-fill-column nov use-package org-bullets lsp-ui lsp-java htmlize gruvbox-theme flycheck-rust dap-mode company-capf)))