From 24fa42a2e179c0eab19de1dcab1674e03574f953 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 6 Mar 2022 19:22:33 +0100 Subject: migrating config --- config.el | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 config.el (limited to 'config.el') diff --git a/config.el b/config.el new file mode 100644 index 0000000..f9736bd --- /dev/null +++ b/config.el @@ -0,0 +1,303 @@ +;;; -*- lexical-binding: t; -*- + +;; (setq doom-font (font-spec :family "Hasklig" :size 15)) +(load-theme 'doom-palenight t) + +(when (version<= "26.0.50" emacs-version ) + (global-display-line-numbers-mode)) + +;; company-mode auto-completion, to turn off use :company-complete +(require 'company) +(setq company-idle-delay 0.2 + company-minimum-prefix-length 3) + +;; hooks to turn on lsp when entering haskell mode +(add-hook 'haskell-mode-hook #'lsp) +(add-hook 'haskell-literate-mode-hook #'lsp) + +(setq org-agenda-files '("~/org" "~/org/roam")) +(setq org-roam-directory "~/org/roam") +(setq org-roam-v2-ack t) + +(setq org-todo-keywords + '((sequence "TODO" "IDEA" "IDLE" "DONE")) + org-todo-keyword-faces + '(("[-]" . +org-todo-active) + ("[?]" . +org-todo-onhold) + ("KILL" . +org-todo-cancel))) + +(add-to-list 'load-path "~/.nix-profile/share/emacs/site-lisp/mu4e/") + +(after! mu4e + (set-email-account! "hacc" + '( (user-mail-address . "stuebinm@hacc.space") + (user-full-name . "stuebinm") + (m4u-maildir . "~/Maildir/hacc") + (mu4e-sent-folder . "/hacc/Sent") + (mu4e-trash-folder . "/hacc/Trash") ) + t)) + +(after! helm-dictionary + (setq helm-dictionary-database + '(("de-en" . "~/org/dict/de-en.txt") + ("es-de" . "~/org/dict/es-de.txt") + ("en-it" . "~/org/dict/en-it-enwiktionary.txt") + ("it-en" . "~/org/dict/it-en-enwiktionary.txt")))) + + + +;; Use carp-mode for .carp files +;(add-to-list 'auto-mode-alist '("\\.carp\\'" . carp-mode)) + + +;; carp-mode and stuff +(add-to-list 'load-path "~/.config/nixpkgs/doom.d/carp-emacs") + +;; (require 'carp-mode) +;; (require 'inf-carp-mode) +;; (require 'carp-flycheck) +;; ;; Use carp-mode for .carp files +;; (add-to-list 'auto-mode-alist '("\\.carp\\'" . carp-mode)) +;; ;; flycheck mode for better type errors +;; (add-hook 'carp-mode-hook +;; (lambda () +;; (flycheck-mode 1))) + +;; hide all these annoying popups that clutter the view +(setq lsp-ui-doc-enable nil) +(setq lsp-ui-sideline-show-code-actions nil) +(setq lsp-signature-render-documentation nil) + +(after! (lsp-ui helm-lsp) + (lsp-signature-activate) + ;; custom version which will not blindly apply a single code action + ;; if only one is available without asking about it first. + ;; Source taken from https://github.com/emacs-lsp/helm-lsp/blob/master/helm-lsp.el + (lsp-make-interactive-code-action wingman-fill-hole "refactor.wingman.fillHole") + (lsp-make-interactive-code-action wingman-case-split "refactor.wingman.caseSplit") + (lsp-make-interactive-code-action wingman-refine "refactor.wingman.refine") + (lsp-make-interactive-code-action wingman-split-func-args "refactor.wingman.spltFuncArgs") + (lsp-make-interactive-code-action wingman-use-constructor "refactor.wingman.useConstructor") + (map! :map haskell-mode-map + "C-c s" #'lsp-wingman-split + "C-c h" #'lsp-wingman-fillhole) + (defun helm-lsp-code-actions-custom() + "Show lsp code actions using helm." + (interactive) + (let ((actions (lsp-code-actions-at-point))) + (cond + ((seq-empty-p actions) (signal 'lsp-no-code-actions nil)) + (t (helm :sources + (helm-build-sync-source + "Code Actions" + :candidates actions + :candidate-transformer + (lambda (candidates) + (-map + (-lambda ((candidate &as + &CodeAction :title)) + (list title :data candidate)) + candidates)) + :action '(("Execute code action" . (lambda(candidate) + (print "selected code action") + (print (plist-get candidate :data)) + (lsp-execute-code-action (plist-get candidate :data))))))))))) + + (map! :map doom-leader-code-map + "a" #'helm-lsp-code-actions-custom)) + + + + + +(use-package! isar-mode + :mode "\\.thy\\'" + :config + ;; (add-hook 'isar-mode-hook 'turn-on-highlight-indentation-mode) + ;; (add-hook 'isar-mode-hook 'flycheck-mode) + (add-hook 'isar-mode-hook 'company-mode) + (add-hook 'isar-mode-hook + (lambda () + (set (make-local-variable 'company-backends) + '((company-dabbrev-code company-yasnippet))))) + (add-hook 'isar-mode-hook + (lambda () + (set (make-local-variable 'indent-tabs-mode) nil))) + (add-hook 'isar-mode-hook + (lambda () + (yas-minor-mode)))) + +(use-package! lsp-isar-parse-args + :custom + (lsp-isar-parse-args-nollvm nil)) + +(use-package! lsp-isar + :commands lsp-isar-define-client-and-start + :custom + (lsp-isar-output-use-async t) + (lsp-isar-output-time-before-printing-goal nil) + (lsp-isar-experimental t) + (lsp-isar-split-pattern 'lsp-isar-split-pattern-three-columns) + (lsp-isar-decorations-delayed-printing t) + :init + (add-hook 'lsp-isar-init-hook 'lsp-isar-open-output-and-progress-right-spacemacs) + (add-hook 'isar-mode-hook #'lsp-isar-define-client-and-start) + + (push (concat "/home/stuebinm/clones/isabelle-emacs/src/Tools/emacs-lsp/yasnippet") + yas-snippet-dirs) + (setq lsp-isar-path-to-isabelle "/home/stuebinm/clones/isabelle-emacs")) + + + + + + + + + + + + + + + +(require 'exwm) +;; (if (boundp 'inexwm) +;; (progn + + + +(defvar desktop-environment-mode-map + (let ((desktop-environment--keybindings + `(;; Brightness + (,(kbd "") . ,(function desktop-environment-brightness-increment)) + (,(kbd "") . ,(function desktop-environment-brightness-decrement)) + (,(kbd "S-") . ,(function desktop-environment-brightness-increment-slowly)) + (,(kbd "S-") . ,(function desktop-environment-brightness-decrement-slowly)) + ;; Volume + (,(kbd "") . ,(function desktop-environment-volume-increment)) + (,(kbd "") . ,(function desktop-environment-volume-decrement)) + (,(kbd "S-") . ,(function desktop-environment-volume-increment-slowly)) + (,(kbd "S-") . ,(function desktop-environment-volume-decrement-slowly)) + (,(kbd "") . ,(function desktop-environment-toggle-mute)) + (,(kbd "") . ,(function desktop-environment-toggle-microphone-mute)) + ;; Screenshot + (,(kbd "S-") . ,(function desktop-environment-screenshot-part)) + (,(kbd "") . ,(function desktop-environment-screenshot)) + ;; Screen locking + (,(kbd "s-c") . ,(function desktop-environment-lock-screen)) + (,(kbd "") . ,(function desktop-environment-lock-screen)) + ;; Wifi controls + (,(kbd "") . ,(function desktop-environment-toggle-wifi)) + ;; Bluetooth controls + (,(kbd "") . ,(function desktop-environment-toggle-bluetooth)) + ;; Music controls + (,(kbd "") . ,(function desktop-environment-toggle-music)) + (,(kbd "") . ,(function desktop-environment-music-previous)) + (,(kbd "") . ,(function desktop-environment-music-next)) + (,(kbd "") . ,(function desktop-environment-music-stop)))) + (map (make-sparse-keymap))) + (dolist (keybinding desktop-environment--keybindings) + (define-key map (car keybinding) (cdr keybinding))) + map) + "Keymap for `desktop-environment-mode'.") + +(defun desktop-environment-exwm-set-global-keybindings (enable) + (when (featurep 'exwm-input) + (when enable + (map-keymap (lambda (event definition) + (exwm-input-set-key (vector event) definition)) + desktop-environment-mode-map)))) + + +;; set up desktop env keybindings with exwm +;(setq desktop-environment-update-global-keys :global) +;(desktop-environment-mode) +(desktop-environment-exwm-set-global-keybindings t) + +;; keybindings for exwm +(exwm-input-set-key (kbd "s-l") 'evil-window-right) +(exwm-input-set-key (kbd "s-k") 'evil-window-up) +(exwm-input-set-key (kbd "s-j") 'evil-window-down) +(exwm-input-set-key (kbd "s-h") 'evil-window-left) +(exwm-input-set-key (kbd "s-L") '+evil/window-move-right) +(exwm-input-set-key (kbd "s-K") '+evil/window-move-up) +(exwm-input-set-key (kbd "s-J") '+evil/window-move-down) +(exwm-input-set-key (kbd "s-H") '+evil/window-move-left) +(exwm-input-set-key (kbd "s-q") 'evil-quit) +(exwm-input-set-key (kbd "s-o") 'delete-other-windows) +(exwm-input-set-key (kbd "s-SPC") 'switch-to-buffer) +(exwm-input-set-key (kbd "s-v") 'evil-window-vsplit) +(exwm-input-set-key (kbd "s-b") 'evil-window-split) +(exwm-input-set-key (kbd "s-V") '+evil/window-vsplit-and-follow) +(exwm-input-set-key (kbd "s-B") '+evil/window-split-and-follow) + +(exwm-input-set-key (kbd "") + 'pulseaudio-control-decrease-volume) +(exwm-input-set-key (kbd "") + 'pulseaudio-control-increase-volume) +(exwm-input-set-key (kbd "") + 'pulseaudio-control-toggle-current-sink-mute) +(exwm-input-set-key (kbd "") + 'pulseaudio-control-select-sink-by-name) + +(exwm-input-set-key (kbd "s-c") 'desktop-environment-lock-screen) +(exwm-input-set-key (kbd "s-x") 'counsel-M-x) + +(exwm-input-set-key (kbd "") + 'desktop-environment-brightness-decrement) +(exwm-input-set-key (kbd "") + 'desktop-environment-brightness-increment) +(exwm-input-set-key (kbd "") + 'desktop-environment-brightness-decrement-slowly) +(exwm-input-set-key (kbd "") + 'desktop-environment-brightness-increment-slowly) + + +;; icons in the tray + (setq display-time-24hr-format 1) + (display-time-mode) + (display-battery-mode) + ;; )) + + + ;; stuff for executing other programs + (require 'simple) + + (defvar execute-command-alist '() + "An association list of (command-call . process-object) for all commands executed.") + + (defconst execute-list-buffer "*Execute Cmd List*" + "Name of the execute listing buffer.") + + (defun execute-program (command) + "Execute the COMMAND asynchronously and track it so later can be listed using `execute-list'." + (interactive (list (read-shell-command "execute command:"))) + (let* ((proc-obj + (start-process-shell-command "execute-process" "execute-process-buffer" command))) + (when proc-obj ; Add to the alist + (setq execute-command-alist + (cons (cons command proc-obj) execute-command-alist)) + (display-buffer (process-buffer proc-obj))))) + + (defun execute-list () + "List all the commands executed." + (interactive) + (with-current-buffer (get-buffer-create execute-list-buffer) + (delete-region (point-min) (point-max)) + (switch-to-buffer (current-buffer)) + (dolist (e execute-command-alist) + (when (process-status (cdr e)) + (insert (format "%d: '%s' - %s - %s\n" + (process-id (cdr e)) + (car e) + (process-status (cdr e)) + (process-buffer (cdr e)))))))) + + + (substitute-key-definition 'shell-command 'execute-program (current-global-map)) + (exwm-input-set-key (kbd "s-s") 'execute-program) + (exwm-input-set-key (kbd "s-t") '(lambda () + "open a kitty terminal" + (interactive) + (execute-program "kitty"))) -- cgit v1.2.3