nix-config/users/tacocat/.config/emacs/init.el
2024-04-27 00:55:31 -04:00

119 lines
3.6 KiB
EmacsLisp

;; Initialize straight package manager
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package material-theme
:config
(load-theme 'material t))
(use-package nerd-icons)
(use-package dashboard
:config
(setq dashboard-center-content t
dashboard-display-icons-p t
dashboard-icon-type 'nerd-icons
dashboard-set-file-icons t)
(dashboard-setup-startup-hook))
(use-package nerd-icons-dired
:hook
(dired-mode . nerd-icons-dired-mode))
(use-package nix-mode
:mode "\\.nix\\'")
(use-package magit
:commands (magit-status magit-get-current-branch))
(use-package diff-hl)
(global-diff-hl-mode)
(diff-hl-flydiff-mode)
(use-package pdf-tools
:magic ("%PDF" . pdf-view-mode)
:config
(pdf-tools-install)
(setq-default pdf-view-display-size 'fit-page))
(use-package markdown-mode
:mode ("README\\.md\\'" . gfm-mode)
:init (setq markdown-command "multimarkdown"))
;; cant get auctex to work
;; (use-package tex
;; :defer t
;; :straight auctex
;; :config
;; (setq TeX-auto-save t))
;; Tell Emacs to prefer the treesitter mode
;; You'll want to run the command `M-x treesit-install-language-grammar' before editing.
(setq major-mode-remap-alist
'((bash-mode . bash-ts-mode)
(c-mode . c-ts-mode)
(c++-mode . c++-ts-mode)
(java-mode . java-ts-mode)
(js-mode . js-ts-mode)
(typescript-mode . typescript-ts-mode)
(rust-mode . rust-ts-mode)
(go-mode . go-ts-mode)
(json-mode . json-ts-mode)
(css-mode . css-ts-mode)
(python-mode . python-ts-mode)))
(setq treesit-language-source-alist
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
(css "https://github.com/tree-sitter/tree-sitter-css")
(go "https://github.com/tree-sitter/tree-sitter-go")
(rust "https://github.com/tree-sitter/tree-sitter-rust")
(html "https://github.com/tree-sitter/tree-sitter-html")
(ruby "https://github.com/tree-sitter/tree-sitter-ruby")
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
(json "https://github.com/tree-sitter/tree-sitter-json")
(python "https://github.com/tree-sitter/tree-sitter-python")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(java "https://github.com/tree-sitter/tree-sitter-java")
(scala "https://github.com/tree-sitter/tree-sitter-scala")
(c "https://github.com/tree-sitter/tree-sitter-c")
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
(elisp "https://github.com/Wilfred/tree-sitter-elisp")))
(setq-default fill-column 80)
(setq-default tab-width 2)
(setq ring-bell-function 'ignore)
(setq display-line-numbers-type 'relative)
(blink-cursor-mode 0)
(global-hl-line-mode 1)
;; Turn off some unneeded UI elements
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(add-hook 'text-mode-hook 'auto-fill-mode)
(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'text-mode-hook 'display-line-numbers-mode)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-to-list 'default-frame-alist
'(font . "Mononoki-14"))