emacs: changed doom config to literate format

This commit is contained in:
Julian Mutter 2022-05-22 14:48:06 -04:00
parent fb79782dad
commit efa2f54c74
2 changed files with 94 additions and 51 deletions

View File

@ -1,8 +1,30 @@
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
#+title: Doom Emacs Config
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
* Main
#+PROPERTY: header-args :results silent
** Help
#+begin_src emacs-lisp :tangle yes
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
#+end_src
** Overall config
#+begin_src emacs-lisp :tangle yes
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
@ -28,38 +50,15 @@
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/Nextcloud/org"
org-roam-directory "~/Nextcloud/org-roam")
;; (map! :nv "SPC r" "SPC n r")
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
#+end_src
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
#+begin_src emacs-lisp :tangle yes
;; Open external terminal
;; (map! :map doom-leader-open-map :desc "Open" "t" (cmd! (call-process-shell-command "terminal&" nil 0)))
(map! :leader :desc "Open external terminal" "o t" (cmd! (call-process-shell-command "xfce4-terminal&" nil 0)))
(map! :leader :desc "Open external terminal" "o t" (cmd! (call-process-shell-command "xfce4-terminal &" nil 0)))
;; Remap font scaling keybindings to make more sense
(map! :desc "Increase font size" :n "C-+" #'text-scale-increase)
@ -70,6 +69,7 @@
(map! :desc "Flycheck previous error" :nv "g N" #'flycheck-previous-error)
(map! :desc "Format and save" :nvi "C-s" #'fd-format-and-save)
(map! :leader "w 1" #'delete-other-windows)
;; Org-mode custom keybindings
(map! :map org-mode-map :nvi "C-k" #'org-backward-element)
@ -77,6 +77,39 @@
(map! :map org-mode-map :nvi "C-h" #'org-up-element)
(map! :map org-mode-map :nvi "C-l" #'org-down-element)
(defun fd-format-and-save()
(interactive)
(company-abort)
(evil-force-normal-state)
(+format/buffer)
(save-buffer))
#+end_src
** Org
#+begin_src emacs-lisp :tangle yes
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/Nextcloud/org"
org-roam-directory "~/Nextcloud/org-roam")
;; (setq org-agenda-files (list "~/org"))
;; (custom-set-variables
;; '(org-directory "~/org")
;; '(org-agenda-files (list org-directory)))
;; (add-to-list 'org-agenda-files "~/org/anothertest.org" 'append)
;; Adding my org-agenda files
(after! org
(setq org-agenda-files (expand-file-name "org-agenda-files" doom-private-dir)))
;; (map! :nv "SPC r" "SPC n r")
#+end_src
** Spell Checking
#+begin_src emacs-lisp :tangle yes
;; Spell checking settings
;; TODO make toggling of spell checking ('SPC t s') use flyspell-mode in text modesm and flyspell-prog-mode in programming modes (see hooks below)
@ -96,7 +129,6 @@
#'flyspell-prog-mode)
(setq ispell-dictionary "english")
(setq lsp-dart-flutter-sdk-dir "/home/julian/snap/flutter/common/flutter")
(map! :map doom-leader-toggle-map :desc "Toggle dictionary" "d" #'fd-switch-dictionary)
@ -107,14 +139,15 @@
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))
#+end_src
(defun fd-format-and-save()
(interactive)
(evil-force-normal-state)
(+format/buffer)
(save-buffer))
** Flutter
#+begin_src emacs-lisp :tangle yes
(add-hook 'tetris-mode-hook #'turn-off-evil-mode)
(setq lsp-dart-flutter-sdk-dir "/home/julian/snap/flutter/common/flutter")
#+end_src
** Evil snipe
#+begin_src emacs-lisp :tangle yes
;; Make sniping simpler for german keyboard
(setq evil-snipe-scope 'visible)
@ -123,11 +156,10 @@
(map! :map evil-snipe-parent-transient-map "," #'evil-snipe-repeat)
(map! :map evil-snipe-parent-transient-map ";" #'evil-snipe-repeat-reverse)
#+end_src
;; (when evil-snipe-override-evil-repeat-keys
;; (evil-define-key 'motion map
;; "," 'evil-snipe-repeat
;; ";" 'evil-snipe-repeat-reverse))
** Python
#+begin_src emacs-lisp :tangle yes
;; Python settings
;; (add-hook 'python-mode-hook (lambda ()
@ -138,6 +170,10 @@
;; (when (flycheck-may-enable-checker 'lsp)
;; (flycheck-select-checker 'python-pylint))))
#+end_src
** Matlab
#+begin_src emacs-lisp :tangle yes
;; (autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
;; (add-to-list
@ -145,17 +181,11 @@
;; '("\\.m$" . matlab-mode))
;; (setq matlab-indent-function t)
;; (setq matlab-shell-command "/urs/local/bin/matlab")
#+end_src
;; (setq org-agenda-files (list "~/org"))
;; (custom-set-variables
;; '(org-directory "~/org")
;; '(org-agenda-files (list org-directory)))
;; (add-to-list 'org-agenda-files "~/org/anothertest.org" 'append)
;; Adding my org-agenda files
(after! org
(setq org-agenda-files (expand-file-name "org-agenda-files" doom-private-dir)))
** Features
*** Toggle word case
#+begin_src elisp :tangle yes
(map! :desc "Toggle case of word" :nv "g C" #'toggle-word-case)
@ -179,6 +209,19 @@
((string= "Lu" first-char-prop) ; Upper case
(downcase-region $p1 (+ $p1 1)))
(t (message "Word does not start with a alphabetic character"))))))
#+end_src
*** Tetris
#+begin_src emacs-lisp :tangle yes
(add-hook 'tetris-mode-hook #'turn-off-evil-mode)
#+end_src
** Company
#+begin_src emacs-lisp :tangle yes
;; Add company-quickhelp
(company-quickhelp-mode)
(map! :map company-active-map "TAB" nil)
(map! :map company-active-map "<tab>" nil)
#+end_src

View File

@ -184,5 +184,5 @@
;;twitter ; twitter client https://twitter.com/vnought
:config
;;literate
literate
(default +bindings +smartparens))