dotfiles/emacs.el
joachimschmidt557 d34338944b
update .emacs
2021-10-03 23:30:58 +02:00

192 lines
4.9 KiB
EmacsLisp

;; .emacs
;; Initialize straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; GCMH - Do this at the beginning so we can maybe start up a bit
;; faster
(straight-use-package 'gcmh)
(gcmh-mode 1)
;; use-package
(straight-use-package 'use-package)
;; Packages
;; Major modes
(straight-use-package 'zig-mode)
(straight-use-package 'markdown-mode)
(straight-use-package 'nix-mode)
(straight-use-package 'nim-mode)
(straight-use-package 'racket-mode)
(straight-use-package 'rust-mode)
(straight-use-package 'haskell-mode)
(straight-use-package 'go-mode)
(straight-use-package 'fish-mode)
(straight-use-package 'svelte-mode)
;; (straight-use-package '(promela-mode
;; :type git
;; :host github
;; :repo "rudi/promela-mode"))
(straight-use-package '(llvm-mode
:type git
:host github
:repo "duzy/llvm-mode"))
(define-minor-mode remove-trailing-whitespace-mode
"Minor mode to remove trailing whitespace on every save"
:lighter " rmtws"
(add-hook 'before-save-hook 'delete-trailing-whitespace))
(add-hook 'prog-mode-hook 'remove-trailing-whitespace-mode)
;; Other stuff
(straight-use-package 'better-defaults)
(straight-use-package 'doom-themes)
(straight-use-package 'undo-tree)
(straight-use-package 'multiple-cursors)
(straight-use-package 'which-key)
(straight-use-package 'smartparens)
(straight-use-package 'rainbow-delimiters)
(straight-use-package 'hl-todo)
;; (straight-use-package 'counsel)
(straight-use-package 'orderless)
(straight-use-package 'selectrum)
(straight-use-package 'consult)
(straight-use-package 'marginalia)
(straight-use-package 'company)
;; (straight-use-package 'eglot)
;; (straight-use-package 'lsp-mode)
(straight-use-package 'speed-type)
(straight-use-package 'magit)
(straight-use-package 'restart-emacs)
(straight-use-package 'mingus)
(straight-use-package 'ace-window)
;; (straight-use-package 'projectile)
;; Emacs Configuration
(setq inhibit-splash-screen t)
(setq scroll-step 1)
(recentf-mode 1)
(global-auto-revert-mode 1)
(put 'narrow-to-region 'disabled nil)
(global-unset-key (kbd "C-z"))
;; (set-face-attribute 'default nil :height 140)
(setq use-package-compute-statistics t)
(use-package display-line-numbers-mode
:hook (prog-mode text-mode conf-mode))
(use-package hl-line-mode
:hook (prog-mode text-mode conf-mode))
;; Personal configuration
(setq user-full-name "Joachim Schmidt"
user-mail-address "joachim.schmidt557@outlook.com")
;; Package Configuration
(use-package nix-mode
:mode "\\.nix\\'")
(use-package zig-mode
:custom
(zig-format-show-buffer nil)
(zig-zig-bin "~/src/zig/build/zig"))
;; (use-package promela-mode
;; :mode "\\.pml\\'")
(use-package undo-tree
:config
(global-undo-tree-mode))
(use-package which-key
:config
(which-key-mode))
(use-package doom-themes
:config
(load-theme 'doom-one t))
(use-package better-defaults)
(use-package multiple-cursors
:bind (("C-x C-l" . mc/edit-lines)
("C-x C-n" . mc/mark-next-like-this)
("C-x C-p" . mc/mark-previous-like-this)))
(use-package smartparens-config
:init
(smartparens-global-strict-mode 1)
:hook (prog-mode . smartparens-mode))
(use-package rainbow-delimiters-mode
:hook prog-mode)
(use-package hl-todo-mode
:hook prog-mode)
;; (use-package ivy
;; :init
;; (ivy-mode 1)
;; ;; (setq ivy-use-virtual-buffers t)
;; (counsel-mode 1)
;; :bind (("C-c i" . counsel-imenu)
;; ("C-x M-r" . counsel-rg)
;; ("C-x M-f" . counsel-fzf)
;; ("C-x C-r" . counsel-recentf)
;; ("C-c C-r" . ivy-resume)))
(use-package orderless
:custom (completion-styles '(orderless)))
(use-package selectrum
:init
(ido-mode nil)
(selectrum-mode t))
(use-package consult
:bind (("C-c i" . consult-imenu)
("C-x b" . consult-buffer)))
(use-package marginalia
:init
(marginalia-mode 1))
(use-package company
:config
(global-company-mode)
:bind (("C-." . company-complete)))
;; (use-package eglot
;; :commands (eglot)
;; :config
;; (add-to-list 'eglot-server-programs '(zig-mode . ("~/src/zls/zig-cache/bin/zls"))))
;; (use-package lsp
;; :config
;; (add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
;; (lsp-register-client
;; (make-lsp-client
;; :new-connection (lsp-stdio-connection "~/src/zls/zig-out/bin/zls")
;; :major-modes '(zig-mode)
;; :server-id 'zls)))
(use-package ace-window
:config
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
:bind (("C-x o" . ace-window)))