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 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ custom.el | 12 +++ init.el | 188 +++++++++++++++++++++++++++++++++++++ packages.el | 83 +++++++++++++++++ 4 files changed, 586 insertions(+) create mode 100644 config.el create mode 100644 custom.el create mode 100644 init.el create mode 100644 packages.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"))) diff --git a/custom.el b/custom.el new file mode 100644 index 0000000..e8a0fcb --- /dev/null +++ b/custom.el @@ -0,0 +1,12 @@ +(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. + '(auth-source-save-behavior nil)) +(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. + ) diff --git a/init.el b/init.el new file mode 100644 index 0000000..7c62cef --- /dev/null +++ b/init.el @@ -0,0 +1,188 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a "Module Index" link where you'll find +;; a comprehensive list of Doom's modules and what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + ;;company ; the ultimate code completion backend + helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ivy ; a search engine for love and life + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + doom-quit ; DOOM quit-message prompts when you quit Emacs + (emoji) ; 🙂 + ;;fill-column ; a `fill-column' indicator + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ;;ligatures ; ligatures and symbols to make your code pretty again + minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + ;;tabs ; a tab bar for Emacs + ;;treemacs ; a project drawer, like neotree but cooler + unicode ; extended unicode support for various languages + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + ;;(format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + ;;multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + ;;ibuffer ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + ;;eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + ;;vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + lsp + magit ; a git porcelain for Emacs + ;;make ; run make tasks from Emacs + ;;pass ; password manager for nerds + pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + ;;rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + tty ; improve the terminal Emacs experience + + :lang + agda ; types of types of types of types... + ;;cc ; C/C++/Obj-C madness + clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + (elixir +lsp) ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;faust ; dsp, but you get to keep your soul + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + (haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + idris ; a language you can depend on + json ; At least it ain't XML + (java +meghanada) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + lean + ;;factor + ;;ledger ; an accounting system in Emacs + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + nix ; I hereby declare "nix geht mehr!" + ocaml ; an objective camel + (org + +roam2 + +pandoc + +noter) ; organize your plain life in plain text + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + (purescript +lsp) ; javascript, but functional + python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + ;;rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;scheme ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + web ; the tubes + yaml ; JSON, but readable + + :email + mu4e ;; +gmail + ;;notmuch + ;;wanderlust ;; +gmail) + + :app + ;;calendar + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) diff --git a/packages.el b/packages.el new file mode 100644 index 0000000..a1ffc3e --- /dev/null +++ b/packages.el @@ -0,0 +1,83 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +(package! lsp-ui) +(package! lsp-mode) + +(package! dhall-mode) +(package! futhark-mode) + +(package! boxquote) + +(package! helm-dictionary) +(package! org-drill) +(package! org-drill-table) + +(package! pulseaudio-control) +(package! desktop-environment) + + +(package! isar-mode + :recipe (:host github :repo "m-fleury/isar-mode")) + +(package! isar-goal-mode + :recipe (:host github :repo "m-fleury/simp-isar-mode")) + +(package! lsp-isar + :recipe (:local-repo "/home/stuebinm/clones/isabelle-emacs/src/Tools/emacs-lsp/lsp-isar")) + +(package! lsp-isar-parse-args + :recipe (:local-repo "/home/stuebinm/clones/isabelle-emacs/src/Tools/emacs-lsp/lsp-isar")) + +(package! session-async) + +(package! request) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/raxod502/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see raxod502/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) + -- cgit v1.2.3