general improvements

This commit is contained in:
Swarsel 2023-12-14 23:31:18 +01:00
parent bde01c8398
commit aed78bb918
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
5 changed files with 822 additions and 720 deletions

669
Emacs.org
View file

@ -21,14 +21,11 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; The default is 800 kilobytes. Measured in bytes. ;; The default is 800 kilobytes. Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
#+end_src #+end_src
** System specific configuration ** Directory setup
- You might need to readjust some of these settings based on your OS and system setup
- Don't forget to install the sync software (here: nextcloud-client). On fedora: 'sudo dnf install nextcloud-client'
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -121,8 +118,8 @@ Here I set up some things that are too minor to put under other categories.
(add-hook 'before-save-hook 'delete-trailing-whitespace) (add-hook 'before-save-hook 'delete-trailing-whitespace)
(global-hl-line-mode 1) (global-hl-line-mode 1)
;; (setq redisplay-dont-pause t) ;; obsolete ;; (setq redisplay-dont-pause t) ;; obsolete
(setq blink-cursor-mode nil) ;; blink-cursor is an unexpected source of slowdown
(delete-selection-mode 1) (delete-selection-mode 1)
(pixel-scroll-precision-mode 1)
(setq vc-follow-symlinks t) (setq vc-follow-symlinks t)
(setq require-final-newline t) (setq require-final-newline t)
(winner-mode 1) (winner-mode 1)
@ -131,6 +128,7 @@ Here I set up some things that are too minor to put under other categories.
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)
(setq load-prefer-newer t) (setq load-prefer-newer t)
(setq browse-url-browser-function 'browse-url-firefox)
;; disable a keybind that does more harm than good ;; disable a keybind that does more harm than good
(global-set-key [remap suspend-frame] (global-set-key [remap suspend-frame]
(lambda () (lambda ()
@ -159,19 +157,24 @@ These settings are mostly useless in my eyes and provide little more than a dist
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq-default indent-tabs-mode nil (setq-default indent-tabs-mode nil
tab-width 2) tab-width 2)
(setq tab-always-indent 'complete) (setq tab-always-indent 'complete)
;; dont send nag when creating python files
(setq python-indent-guess-indent-offset-verbose nil)
(use-package highlight-indent-guides (use-package highlight-indent-guides
:hook (prog-mode . highlight-indent-guides-mode) :hook (prog-mode . highlight-indent-guides-mode)
:init :init
(setq highlight-indent-guides-method 'character) (setq highlight-indent-guides-method 'column)
(setq highlight-indent-guides-character "|") ;; (setq highlight-indent-guides-method 'character)
;; (setq highlight-indent-guides-character ?|)
(setq highlight-indent-guides-responsive 'top) (setq highlight-indent-guides-responsive 'top)
) )
;;(set-face--background 'highlight-indent-guides-odd-face "dark slate gray")
;;(set-face-background 'highlight-indent-guides-even-face "steel blue")
;;(set-face-foreground 'highlight-indent-guides-character-face "dark violet")
#+end_src #+end_src
** Scrolling ** Scrolling
@ -182,7 +185,17 @@ By default, emacs scrolls half a page when reaching the bottom of the buffer. Th
(setq scroll-step 1 (setq scroll-step 1
scroll-margin 4 scroll-margin 4
scroll-conservatively 5) scroll-conservatively 101)
;; (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
;; (setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
;; (setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(pixel-scroll-precision-mode 1)
;; (use-package fast-scroll
;; :ensure nil
;; :init (fast-scroll-mode 1))
#+end_src #+end_src
@ -249,34 +262,24 @@ This function will check if a directory for which a file we want to open exists;
(evil-collection-init) (evil-collection-init)
(setq forge-add-default-bindings nil)) (setq forge-add-default-bindings nil))
;; enables 2-char inline search
(use-package evil-snipe (use-package evil-snipe
:after evil :after evil
:demand :demand
:config :config
(evil-snipe-mode +1) (evil-snipe-mode +1)
;; replace 1-char searches (f&t) with this better UI
(evil-snipe-override-mode +1)) (evil-snipe-override-mode +1))
;; for parentheses-heavy languades modify evil commands to keep balance of parantheses
(use-package evil-cleverparens) (use-package evil-cleverparens)
;; enables surrounding text with S
(use-package evil-surround
:config
(global-evil-surround-mode 1))
(use-package evil-surround)
(use-package evil-goggles
:after evil
:demand
:init
(setq evil-goggles-duration 0.05)
:config
(push '(evil-operator-eval
:face evil-goggles-yank-face
:switch evil-goggles-enable-yank
:advice evil-goggles--generic-async-advice)
evil-goggles--commands)
(evil-goggles-mode)
(evil-goggles-use-diff-faces)
)
#+end_src #+end_src
@ -343,6 +346,7 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
"t" '(:ignore t :which-key "toggles") "t" '(:ignore t :which-key "toggles")
"ts" '(hydra-text-scale/body :which-key "scale text") "ts" '(hydra-text-scale/body :which-key "scale text")
"tl" '(display-line-numbers-mode :which-key "line numbers") "tl" '(display-line-numbers-mode :which-key "line numbers")
"tp" '(evil-cleverparens-mode :wk "cleverparens")
"to" '(olivetti-mode :wk "olivetti") "to" '(olivetti-mode :wk "olivetti")
"td" '(darkroom-tentative-mode :wk "darkroom") "td" '(darkroom-tentative-mode :wk "darkroom")
"tw" '((lambda () (interactive) (toggle-truncate-lines)) :which-key "line wrapping") "tw" '((lambda () (interactive) (toggle-truncate-lines)) :which-key "line wrapping")
@ -352,21 +356,21 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
"mc" '((lambda () (interactive) (swarsel/open-calendar)) :which-key "calendar") "mc" '((lambda () (interactive) (swarsel/open-calendar)) :which-key "calendar")
"mp" '(popper-toggle :which-key "popper") "mp" '(popper-toggle :which-key "popper")
"md" '(dirvish :which-key "dirvish") "md" '(dirvish :which-key "dirvish")
"c" '(:ignore c :which-key "capture") ;; "c" '(:ignore c :which-key "capture")
"cj" '((lambda () (interactive) (org-capture nil "jj")) :which-key "journal") ;; "cj" '((lambda () (interactive) (org-capture nil "jj")) :which-key "journal")
"cs" '(markdown-download-screenshot :which-key "screenshot") ;; "cs" '(markdown-download-screenshot :which-key "screenshot")
"l" '(:ignore l :which-key "links") "l" '(:ignore l :which-key "links")
"le" '((lambda () (interactive) (find-file swarsel-emacs-org-filepath)) :which-key "Emacs.org") "le" '((lambda () (interactive) (find-file swarsel-emacs-org-filepath)) :which-key "Emacs.org")
"ls" '((lambda () (interactive) (find-file "/smb:Swarsel@192.168.1.3:")) :which-key "Server") "ls" '((lambda () (interactive) (find-file "/smb:Swarsel@192.168.1.3:")) :which-key "Server")
"lo" '(dired swarsel-obsidian-vault-directory :which-key "obsidian") "lo" '(dired swarsel-obsidian-vault-directory :which-key "obsidian")
"la" '((lambda () (interactive) (find-file swarsel-org-anki-filepath)) :which-key "anki") ;; "la" '((lambda () (interactive) (find-file swarsel-org-anki-filepath)) :which-key "anki")
"ln" '((lambda () (interactive) (find-file swarsel-nix-org-filepath)) :which-key "Nix.org") "ln" '((lambda () (interactive) (find-file swarsel-nix-org-filepath)) :which-key "Nix.org")
"lp" '((lambda () (interactive) (projectile-switch-project)) :which-key "switch project") "lp" '((lambda () (interactive) (projectile-switch-project)) :which-key "switch project")
"lg" '((lambda () (interactive) (magit-list-repositories)) :which-key "list git repos") "lg" '((lambda () (interactive) (magit-list-repositories)) :which-key "list git repos")
"a" '(:ignore a :which-key "anki") ;; "a" '(:ignore a :which-key "anki")
"ap" '(anki-editor-push-tree :which-key "push new cards") ;; "ap" '(anki-editor-push-tree :which-key "push new cards")
"an" '((lambda () (interactive) (org-capture nil "a")) :which-key "new card") ;; "an" '((lambda () (interactive) (org-capture nil "a")) :which-key "new card")
"as" '(swarsel-anki-set-deck-and-notetype :which-key "change deck and notetype") ;; "as" '(swarsel-anki-set-deck-and-notetype :which-key "change deck and notetype")
"h" '(:ignore h :which-key "help") "h" '(:ignore h :which-key "help")
"hy" '(yas-describe-tables :which-key "yas tables") "hy" '(yas-describe-tables :which-key "yas tables")
"hb" '(embark-bindings :which-key "current key bindings") "hb" '(embark-bindings :which-key "current key bindings")
@ -377,6 +381,7 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
"hl" '(view-lossage :which-key "show command keypresses") "hl" '(view-lossage :which-key "show command keypresses")
"hL" 'find-library "hL" 'find-library
"hm" 'describe-mode "hm" 'describe-mode
"ho" 'describe-symbol
"hk" 'describe-key "hk" 'describe-key
"hK" 'describe-keymap "hK" 'describe-keymap
"hp" 'describe-package "hp" 'describe-package
@ -401,9 +406,9 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
;; General often used hotkeys ;; General often used hotkeys
(general-define-key (general-define-key
"C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card "C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card
"C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist ;; "C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist
"C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetye for new anki cards ;; "C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetye for new anki cards
"C-M-s" 'markdown-download-screenshot ; wrapper for org-download-screenshot ;; "C-M-s" 'markdown-download-screenshot ; wrapper for org-download-screenshot
"C-c d" 'duplicate-line ; duplicate line on CURSOR "C-c d" 'duplicate-line ; duplicate line on CURSOR
"C-M-j" 'consult-buffer "C-M-j" 'consult-buffer
"C-s" 'consult-line "C-s" 'consult-line
@ -435,9 +440,6 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
(use-package rainbow-mode (use-package rainbow-mode
:config (rainbow-mode)) :config (rainbow-mode))
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(add-hook 'prog-mode-hook 'display-line-numbers-mode) (add-hook 'prog-mode-hook 'display-line-numbers-mode)
@ -488,15 +490,22 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package doom-themes
:init (load-theme 'doom-city-lights t))
(use-package solaire-mode (use-package solaire-mode
:init (solaire-global-mode +1)) :defer t
:custom (solaire-global-mode +1))
(use-package doom-themes
:defer t
:hook (server-after-make-frame . (lambda () (load-theme
'doom-city-lights t)))
)
#+end_src #+end_src
*** Transparent background *** Transparent background
This is handled by Nix and no longer needed here.
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (set-frame-parameter (selected-frame) 'alpha '(95 . 95)) ;; (set-frame-parameter (selected-frame) 'alpha '(95 . 95))
@ -811,11 +820,11 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
;; (setq evil-auto-indent nil) ;; (setq evil-auto-indent nil)
;;(diminish org-indent-mode) ;;(diminish org-indent-mode)
(defun swarsel/org-font-setup () ;; (defun swarsel/org-font-setup ()
;; Replace list hyphen with dot ;; ;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode ;; (font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) " ;; '(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))) ;; (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
(use-package org (use-package org
;;:diminish (org-indent-mode) ;;:diminish (org-indent-mode)
@ -826,9 +835,9 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
org-hide-emphasis-markers t) org-hide-emphasis-markers t)
(setq org-startup-folded t) (setq org-startup-folded t)
(setq org-support-shift-select t) (setq org-support-shift-select t)
(setq org-agenda-start-with-log-mode t) ;; (setq org-agenda-start-with-log-mode t)
(setq org-log-done 'time) ;; (setq org-log-done 'time)
(setq org-log-into-drawer t) ;; (setq org-log-into-drawer t)
(setq org-startup-with-inline-images t) (setq org-startup-with-inline-images t)
(setq org-image-actual-width nil) (setq org-image-actual-width nil)
(setq org-format-latex-options '(:foreground "White" :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))) (setq org-format-latex-options '(:foreground "White" :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
@ -837,95 +846,95 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
;; '(swarsel-org-tasks-filepath ;; '(swarsel-org-tasks-filepath
;; swarsel-org-archive-filepath ;; swarsel-org-archive-filepath
;; swarsel-org-anki-filepath)) ;; swarsel-org-anki-filepath))
(setq org-agenda-files '("/home/swarsel/Calendars/leon_cal.org"))
(setq org-agenda-files
'("~/Calendars/leon_cal.org"))
(require 'org-habit) ;; (require 'org-habit)
(add-to-list 'org-modules 'org-habit) ;; (add-to-list 'org-modules 'org-habit)
(setq org-habit-graph-column 60) ;; (setq org-habit-graph-column 60)
(setq org-todo-keywords ;; (setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") ;; '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
(sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)"))) ;; (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)")))
(setq org-refile-targets ;; (setq org-refile-targets
'((swarsel-archive-org-file :maxlevel . 1) ;; '((swarsel-archive-org-file :maxlevel . 1)
(swarsel-anki-org-file :maxlevel . 1) ;; (swarsel-anki-org-file :maxlevel . 1)
(swarsel-tasks-org-file :maxlevel . 1))) ;; (swarsel-tasks-org-file :maxlevel . 1)))
;; Configure custom agenda views ;; ;; Configure custom agenda views
(setq org-agenda-custom-commands ;; (setq org-agenda-custom-commands
'(("d" "Dashboard" ;; '(("d" "Dashboard"
((agenda "" ((org-deadline-warning-days 7))) ;; ((agenda "" ((org-deadline-warning-days 7)))
(todo "NEXT" ;; (todo "NEXT"
((org-agenda-overriding-header "Next Tasks"))) ;; ((org-agenda-overriding-header "Next Tasks")))
(tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects"))))) ;; (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects")))))
("n" "Next Tasks" ;; ("n" "Next Tasks"
((todo "NEXT" ;; ((todo "NEXT"
((org-agenda-overriding-header "Next Tasks"))))) ;; ((org-agenda-overriding-header "Next Tasks")))))
("W" "Work Tasks" tags-todo "+work-email") ;; ("W" "Work Tasks" tags-todo "+work-email")
;; Low-effort next actions ;; ;; Low-effort next actions
("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0" ;; ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0"
((org-agenda-overriding-header "Low Effort Tasks") ;; ((org-agenda-overriding-header "Low Effort Tasks")
(org-agenda-max-todos 20) ;; (org-agenda-max-todos 20)
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
("w" "Workflow Status" ;; ("w" "Workflow Status"
((todo "WAIT" ;; ((todo "WAIT"
((org-agenda-overriding-header "Waiting on External") ;; ((org-agenda-overriding-header "Waiting on External")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "REVIEW" ;; (todo "REVIEW"
((org-agenda-overriding-header "In Review") ;; ((org-agenda-overriding-header "In Review")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "PLAN" ;; (todo "PLAN"
((org-agenda-overriding-header "In Planning") ;; ((org-agenda-overriding-header "In Planning")
(org-agenda-todo-list-sublevels nil) ;; (org-agenda-todo-list-sublevels nil)
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "BACKLOG" ;; (todo "BACKLOG"
((org-agenda-overriding-header "Project Backlog") ;; ((org-agenda-overriding-header "Project Backlog")
(org-agenda-todo-list-sublevels nil) ;; (org-agenda-todo-list-sublevels nil)
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "READY" ;; (todo "READY"
((org-agenda-overriding-header "Ready for Work") ;; ((org-agenda-overriding-header "Ready for Work")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "ACTIVE" ;; (todo "ACTIVE"
((org-agenda-overriding-header "Active Projects") ;; ((org-agenda-overriding-header "Active Projects")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "COMPLETED" ;; (todo "COMPLETED"
((org-agenda-overriding-header "Completed Projects") ;; ((org-agenda-overriding-header "Completed Projects")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "CANC" ;; (todo "CANC"
((org-agenda-overriding-header "Cancelled Projects") ;; ((org-agenda-overriding-header "Cancelled Projects")
(org-agenda-files org-agenda-files))))))) ;; (org-agenda-files org-agenda-files)))))))
(setq org-capture-templates ;; (setq org-capture-templates
`( ;; `(
("a" "Anki basic" ;; ("a" "Anki basic"
entry ;; entry
(file+headline swarsel-org-anki-filepath "Dispatch") ;; (file+headline swarsel-org-anki-filepath "Dispatch")
(function swarsel-anki-make-template-string)) ;; (function swarsel-anki-make-template-string))
("A" "Anki cloze" ;; ("A" "Anki cloze"
entry ;; entry
(file+headline org-swarsel-anki-file "Dispatch") ;; (file+headline org-swarsel-anki-file "Dispatch")
"* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Cloze\n:ANKI_DECK: 🦁 All::01 ❤️ Various::00 ✨ Allgemein\n:END:\n** Text\n%?\n** Extra\n") ;; "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Cloze\n:ANKI_DECK: 🦁 All::01 ❤️ Various::00 ✨ Allgemein\n:END:\n** Text\n%?\n** Extra\n")
("t" "Tasks / Projects") ;; ("t" "Tasks / Projects")
("tt" "Task" entry (file+olp swarsel-org-tasks-filepath "Inbox") ;; ("tt" "Task" entry (file+olp swarsel-org-tasks-filepath "Inbox")
"* TODO %?\n %U\n %a\n %i" :empty-lines 1) ;; "* TODO %?\n %U\n %a\n %i" :empty-lines 1)
("j" "Journal Entries") ;; ("j" "Journal Entries")
("jj" "Journal" entry ;; ("jj" "Journal" entry
(file+olp+datetree swarsel-org-journal-filepath) ;; (file+olp+datetree swarsel-org-journal-filepath)
"\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n" ;; "\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org") ;; ;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org")
:clock-in :clock-resume ;; :clock-in :clock-resume
:empty-lines 1))) ;; :empty-lines 1)))
(swarsel/org-font-setup)) ;; (swarsel/org-font-setup)
)
#+end_src #+end_src
** Font Faces ** Font Faces
@ -960,12 +969,12 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Show hidden emphasis markers ;; Show hidden emphasis markers
(use-package org-appear ;; (use-package org-appear
:hook (org-mode . org-appear-mode) ;; :hook (org-mode . org-appear-mode)
:init ;; :init
(setq org-appear-autolinks t) ;; (setq org-appear-autolinks t)
(setq org-appear-autosubmarkers t) ;; (setq org-appear-autosubmarkers t)
) ;; )
#+end_src #+end_src
@ -973,11 +982,11 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org-bullets ;; (use-package org-bullets
:after org ;; :after org
:hook (org-mode . org-bullets-mode) ;; :hook (org-mode . org-bullets-mode)
:custom ;; :custom
(org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●"))) ;; (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
#+end_src #+end_src
@ -1185,104 +1194,104 @@ This is a section adapted from org-download to make some org-download functions
;; these next lines provide an interface for org-download in markdown mode for use with obsidian ;; these next lines provide an interface for org-download in markdown mode for use with obsidian
(defvar org-download-markdown-link-format ;; (defvar org-download-markdown-link-format
"![[./%s]]\n" ;; "![[./%s]]\n"
"Format of the file link to insert.") ;; "Format of the file link to insert.")
(defcustom org-download-markdown-link-format-function #'org-download-markdown-link-format-function-default ;; (defcustom org-download-markdown-link-format-function #'org-download-markdown-link-format-function-default
"Function that takes FILENAME and returns a org link." ;; "Function that takes FILENAME and returns a org link."
:type 'function) ;; :type 'function)
(defun org-download-markdown-link-format-function-default (filename) ;; (defun org-download-markdown-link-format-function-default (filename)
"The default function of `org-download-link-format-function'." ;; "The default function of `org-download-link-format-function'."
(if (and (>= (string-to-number org-version) 9.3) ;; (if (and (>= (string-to-number org-version) 9.3)
(eq org-download-method 'attach)) ;; (eq org-download-method 'attach))
(format "[[attachment:%s]]\n" ;; (format "[[attachment:%s]]\n"
(org-link-escape ;; (org-link-escape
(file-relative-name filename (org-attach-dir)))) ;; (file-relative-name filename (org-attach-dir))))
(format org-download-markdown-link-format ;; (format org-download-markdown-link-format
(org-link-escape ;; (org-link-escape
(funcall org-download-abbreviate-filename-function filename))))) ;; (funcall org-download-abbreviate-filename-function filename)))))
(defun org-download-markdown-image (link) ;; (defun org-download-markdown-image (link)
"Save image at address LINK to `org-download--dir'." ;; "Save image at address LINK to `org-download--dir'."
(interactive "sUrl: ") ;; (interactive "sUrl: ")
(let* ((link-and-ext (org-download--parse-link link)) ;; (let* ((link-and-ext (org-download--parse-link link))
(filename ;; (filename
(cond ((and (derived-mode-p 'org-mode) ;; (cond ((and (derived-mode-p 'org-mode)
(eq org-download-method 'attach)) ;; (eq org-download-method 'attach))
(let ((org-download-image-dir (org-attach-dir t)) ;; (let ((org-download-image-dir (org-attach-dir t))
org-download-heading-lvl) ;; org-download-heading-lvl)
(apply #'org-download--fullname link-and-ext))) ;; (apply #'org-download--fullname link-and-ext)))
((fboundp org-download-method) ;; ((fboundp org-download-method)
(funcall org-download-method link)) ;; (funcall org-download-method link))
(t ;; (t
(apply #'org-download--fullname link-and-ext))))) ;; (apply #'org-download--fullname link-and-ext)))))
(setq org-download-path-last-file filename) ;; (setq org-download-path-last-file filename)
(org-download--image link filename) ;; (org-download--image link filename)
(when (org-download-org-mode-p) ;; (when (org-download-org-mode-p)
(when (eq org-download-method 'attach) ;; (when (eq org-download-method 'attach)
(org-attach-attach filename nil 'none)) ;; (org-attach-attach filename nil 'none))
(org-download-markdown-insert-link link filename)) ;; (org-download-markdown-insert-link link filename))
(when (and (eq org-download-delete-image-after-download t) ;; (when (and (eq org-download-delete-image-after-download t)
(not (url-handler-file-remote-p (current-kill 0)))) ;; (not (url-handler-file-remote-p (current-kill 0))))
(delete-file link delete-by-moving-to-trash)))) ;; (delete-file link delete-by-moving-to-trash))))
(defun org-download-markdown-screenshot (&optional basename) ;; (defun org-download-markdown-screenshot (&optional basename)
"Capture screenshot and insert the resulting file. ;; "Capture screenshot and insert the resulting file.
The screenshot tool is determined by `org-download-screenshot-method'." ;; The screenshot tool is determined by `org-download-screenshot-method'."
(interactive) ;; (interactive)
(let* ((screenshot-dir (file-name-directory org-download-screenshot-file)) ;; (let* ((screenshot-dir (file-name-directory org-download-screenshot-file))
(org-download-screenshot-file ;; (org-download-screenshot-file
(if basename ;; (if basename
(concat screenshot-dir basename) org-download-screenshot-file))) ;; (concat screenshot-dir basename) org-download-screenshot-file)))
(make-directory screenshot-dir t) ;; (make-directory screenshot-dir t)
(if (functionp org-download-screenshot-method) ;; (if (functionp org-download-screenshot-method)
(funcall org-download-screenshot-method ;; (funcall org-download-screenshot-method
org-download-screenshot-file) ;; org-download-screenshot-file)
(shell-command-to-string ;; (shell-command-to-string
(format org-download-screenshot-method ;; (format org-download-screenshot-method
org-download-screenshot-file))) ;; org-download-screenshot-file)))
(when (file-exists-p org-download-screenshot-file) ;; (when (file-exists-p org-download-screenshot-file)
(org-download-markdown-image org-download-screenshot-file) ;; (org-download-markdown-image org-download-screenshot-file)
(delete-file org-download-screenshot-file)))) ;; (delete-file org-download-screenshot-file))))
(defun org-download-markdown-insert-link (link filename) ;; (defun org-download-markdown-insert-link (link filename)
(let* ((beg (point)) ;; (let* ((beg (point))
(line-beg (line-beginning-position)) ;; (line-beg (line-beginning-position))
(indent (- beg line-beg)) ;; (indent (- beg line-beg))
(in-item-p (org-in-item-p)) ;; (in-item-p (org-in-item-p))
str) ;; str)
(if (looking-back "^[ \t]+" line-beg) ;; (if (looking-back "^[ \t]+" line-beg)
(delete-region (match-beginning 0) (match-end 0)) ;; (delete-region (match-beginning 0) (match-end 0))
(newline)) ;; (newline))
(insert (funcall org-download-annotate-function link)) ;; (insert (funcall org-download-annotate-function link))
(dolist (attr org-download-image-attr-list) ;; (dolist (attr org-download-image-attr-list)
(insert attr "\n")) ;; (insert attr "\n"))
(insert (if (= org-download-image-html-width 0) ;; (insert (if (= org-download-image-html-width 0)
"" ;; ""
(format "#+attr_html: :width %dpx\n" org-download-image-html-width))) ;; (format "#+attr_html: :width %dpx\n" org-download-image-html-width)))
(insert (if (= org-download-image-latex-width 0) ;; (insert (if (= org-download-image-latex-width 0)
"" ;; ""
(format "#+attr_latex: :width %dcm\n" org-download-image-latex-width))) ;; (format "#+attr_latex: :width %dcm\n" org-download-image-latex-width)))
(insert (if (= org-download-image-org-width 0) ;; (insert (if (= org-download-image-org-width 0)
"" ;; ""
(format "#+attr_org: :width %dpx\n" org-download-image-org-width))) ;; (format "#+attr_org: :width %dpx\n" org-download-image-org-width)))
(insert (funcall org-download-markdown-link-format-function filename)) ;; (insert (funcall org-download-markdown-link-format-function filename))
(org-download--display-inline-images) ;; (org-download--display-inline-images)
(setq str (buffer-substring-no-properties line-beg (point))) ;; (setq str (buffer-substring-no-properties line-beg (point)))
(when in-item-p ;; (when in-item-p
(indent-region line-beg (point) indent)) ;; (indent-region line-beg (point) indent))
str)) ;; str))
(defun markdown-download-screenshot () ;; (defun markdown-download-screenshot ()
(interactive) ;; (interactive)
(org-mode) ;; (org-mode)
(org-download-markdown-screenshot) ;; (org-download-markdown-screenshot)
(markdown-mode)) ;; (markdown-mode))
(add-hook 'markdown-mode-hook (lambda () (org-display-inline-images))) ;;(add-hook 'markdown-mode-hook (lambda () (org-display-inline-images)))
#+end_src #+end_src
@ -1518,12 +1527,14 @@ I am not completely sure on electric-pair-mode yet, sometimes it is very helpful
(use-package highlight-parentheses (use-package highlight-parentheses
:config :config
(setq highlight-parentheses-colors nil) (setq highlight-parentheses-colors '("black" "white" "black" "black" "black" "black" "black"))
(setq highlight-parentheses-background-colors '("magenta" "blue" "cyan" "green" "yellow" "orange" "red")) (setq highlight-parentheses-background-colors '("magenta" "blue" "cyan" "green" "yellow" "orange" "red"))
(global-highlight-parentheses-mode t)) (global-highlight-parentheses-mode t))
(electric-pair-mode 1) (electric-pair-mode 1)
(setq electric-pair-preserve-balance nil) (setq electric-pair-preserve-balance nil)
;; don't try to be overly smart
(setq electric-pair-delete-adjacent-pairs nil)
;; don't skip newline when auto-pairing parenthesis ;; don't skip newline when auto-pairing parenthesis
(setq electric-pair-skip-whitespace-chars '(9 32)) (setq electric-pair-skip-whitespace-chars '(9 32))
@ -1557,7 +1568,7 @@ The plan is to in the future use Vertico etc. instead and then switch to Corfu.
*** IN USE Corfu *** IN USE Corfu
Currently unused. Currently unused
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -1579,7 +1590,7 @@ Currently unused.
(corfu-cycle t) (corfu-cycle t)
(corfu-quit-no-match 'separator) (corfu-quit-no-match 'separator)
(corfu-separator ?\s) (corfu-separator ?\s)
(corfu-quit-no-match t) ;; (corfu-quit-no-match t)
(corfu-popupinfo-max-height 70) (corfu-popupinfo-max-height 70)
(corfu-popupinfo-delay '(0.5 . 0.2)) (corfu-popupinfo-delay '(0.5 . 0.2))
;; (corfu-preview-current 'insert) ; insert previewed candidate ;; (corfu-preview-current 'insert) ; insert previewed candidate
@ -1589,19 +1600,28 @@ Currently unused.
:bind (:map corfu-map :bind (:map corfu-map
("M-SPC" . corfu-insert-separator) ("M-SPC" . corfu-insert-separator)
("<return>" . swarsel/corfu-normal-return) ("<return>" . swarsel/corfu-normal-return)
;; ("C-<return>" . swarsel/corfu-complete)
("S-<up>" . corfu-popupinfo-scroll-down) ("S-<up>" . corfu-popupinfo-scroll-down)
("S-<down>" . corfu-popupinfo-scroll-up) ("S-<down>" . corfu-popupinfo-scroll-up)
("C-<up>" . corfu-previous) ("C-<up>" . corfu-previous)
("C-<down>" . corfu-next) ("C-<down>" . corfu-next)
("<up>" . swarsel/corfu-quit-and-up) ("<up>" . swarsel/corfu-quit-and-up)
("<down>" . swarsel/corfu-quit-and-down)) ("<down>" . swarsel/corfu-quit-and-down))
) )
;; dont disrupt file navigation with completions ;; dont disrupt file navigation with completions
(defun swarsel/corfu-normal-return (&optional arg) (defun swarsel/corfu-normal-return (&optional arg)
(interactive) (interactive)
(corfu-complete) (corfu-quit)
(corfu-quit)) (newline)
)
;; (defun swarsel/corfu-complete (&optional arg)
;; (interactive)
;; (corfu-complete)
;; (newline)
;; )
(defun swarsel/corfu-quit-and-up (&optional arg) (defun swarsel/corfu-quit-and-up (&optional arg)
(interactive) (interactive)
@ -1651,15 +1671,15 @@ Currently unused.
(add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-file) (add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-elisp-block) (add-to-list 'completion-at-point-functions #'cape-elisp-block)
;;(add-to-list 'completion-at-point-functions #'cape-history) ;; (add-to-list 'completion-at-point-functions #'cape-history)
;;(add-to-list 'completion-at-point-functions #'cape-keyword) ;; (add-to-list 'completion-at-point-functions #'cape-keyword)
;;(add-to-list 'completion-at-point-functions #'cape-tex) ;; (add-to-list 'completion-at-point-functions #'cape-tex)
;;(add-to-list 'completion-at-point-functions #'cape-sgml) ;; (add-to-list 'completion-at-point-functions #'cape-sgml)
;;(add-to-list 'completion-at-point-functions #'cape-rfc1345) ;; (add-to-list 'completion-at-point-functions #'cape-rfc1345)
;;(add-to-list 'completion-at-point-functions #'cape-abbrev) ;; (add-to-list 'completion-at-point-functions #'cape-abbrev)
;;(add-to-list 'completion-at-point-functions #'cape-dict) ;; (add-to-list 'completion-at-point-functions #'cape-dict)
;;(add-to-list 'completion-at-point-functions #'cape-elisp-symbol) (add-to-list 'completion-at-point-functions #'cape-elisp-symbol)
;;(add-to-list 'completion-at-point-functions #'cape-line) ;; (add-to-list 'completion-at-point-functions #'cape-line)
) )
#+end_src #+end_src
@ -2184,23 +2204,23 @@ The following block is 100% stolen from Dominik :P
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package obsidian ;; (use-package obsidian
:ensure t ;; :ensure t
:demand t ;; :demand t
:config ;; :config
(obsidian-specify-path swarsel-obsidian-vault-directory) ;; (obsidian-specify-path swarsel-obsidian-vault-directory)
(global-obsidian-mode t) ;; (global-obsidian-mode t)
:custom ;; :custom
;; This directory will be used for `obsidian-capture' if set. ;; ;; This directory will be used for `obsidian-capture' if set.
(obsidian-inbox-directory "Inbox") ;; (obsidian-inbox-directory "Inbox")
(bind-key (kbd "C-c M-o") 'obsidian-hydra/body 'obsidian-mode-map) ;; (bind-key (kbd "C-c M-o") 'obsidian-hydra/body 'obsidian-mode-map)
:bind (:map obsidian-mode-map ;; :bind (:map obsidian-mode-map
;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding. ;; ;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding.
("C-c C-o" . obsidian-follow-link-at-point) ;; ("C-c C-o" . obsidian-follow-link-at-point)
;; Jump to backlinks ;; ;; Jump to backlinks
("C-c C-b" . obsidian-backlink-jump) ;; ("C-c C-b" . obsidian-backlink-jump)
;; If you prefer you can use `obsidian-insert-link' ;; ;; If you prefer you can use `obsidian-insert-link'
("C-c C-l" . obsidian-insert-wikilink))) ;; ("C-c C-l" . obsidian-insert-wikilink)))
#+end_src #+end_src
@ -2210,43 +2230,43 @@ The following block is 100% stolen from Dominik :P
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package anki-editor ;; (use-package anki-editor
:after org ;; :after org
:bind (:map org-mode-map ;; :bind (:map org-mode-map
("<f12>" . anki-editor-cloze-region-auto-incr) ;; ("<f12>" . anki-editor-cloze-region-auto-incr)
("<f11>" . anki-editor-cloze-region-dont-incr) ;; ("<f11>" . anki-editor-cloze-region-dont-incr)
("<f10>" . anki-editor-reset-cloze-number) ;; ("<f10>" . anki-editor-reset-cloze-number)
("<f9>" . anki-editor-push-tree)) ;; ("<f9>" . anki-editor-push-tree))
:hook (org-capture-after-finalize . anki-editor-reset-cloze-number) ; Reset cloze-number after each capture. ;; :hook (org-capture-after-finalize . anki-editor-reset-cloze-number) ; Reset cloze-number after each capture.
:config ;; :config
(setq anki-editor-create-decks t ;; Allow anki-editor to create a new deck if it doesn't exist ;; (setq anki-editor-create-decks t ;; Allow anki-editor to create a new deck if it doesn't exist
anki-editor-org-tags-as-anki-tags t) ;; anki-editor-org-tags-as-anki-tags t)
(defun anki-editor-cloze-region-auto-incr (&optional arg) ;; (defun anki-editor-cloze-region-auto-incr (&optional arg)
"Cloze region without hint and increase card number." ;; "Cloze region without hint and increase card number."
(interactive) ;; (interactive)
(anki-editor-cloze-region swarsel-anki-editor-cloze-number "") ;; (anki-editor-cloze-region swarsel-anki-editor-cloze-number "")
(setq swarsel-anki-editor-cloze-number (1+ swarsel-anki-editor-cloze-number)) ;; (setq swarsel-anki-editor-cloze-number (1+ swarsel-anki-editor-cloze-number))
(forward-sexp)) ;; (forward-sexp))
(defun anki-editor-cloze-region-dont-incr (&optional arg) ;; (defun anki-editor-cloze-region-dont-incr (&optional arg)
"Cloze region without hint using the previous card number." ;; "Cloze region without hint using the previous card number."
(interactive) ;; (interactive)
(anki-editor-cloze-region (1- swarsel-anki-editor-cloze-number) "") ;; (anki-editor-cloze-region (1- swarsel-anki-editor-cloze-number) "")
(forward-sexp)) ;; (forward-sexp))
(defun anki-editor-reset-cloze-number (&optional arg) ;; (defun anki-editor-reset-cloze-number (&optional arg)
"Reset cloze number to ARG or 1" ;; "Reset cloze number to ARG or 1"
(interactive) ;; (interactive)
(setq swarsel-anki-editor-cloze-number (or arg 1))) ;; (setq swarsel-anki-editor-cloze-number (or arg 1)))
(defun anki-editor-push-tree () ;; (defun anki-editor-push-tree ()
"Push all notes under a tree." ;; "Push all notes under a tree."
(interactive) ;; (interactive)
(anki-editor-push-notes '(4)) ;; (anki-editor-push-notes '(4))
(anki-editor-reset-cloze-number)) ;; (anki-editor-reset-cloze-number))
;; Initialize ;; ;; Initialize
(anki-editor-reset-cloze-number) ;; (anki-editor-reset-cloze-number)
) ;; )
(require 'anki-editor) ;; (require 'anki-editor)
#+end_src #+end_src
@ -2256,35 +2276,35 @@ The following block is 100% stolen from Dominik :P
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar swarsel-anki-deck nil) ;; (defvar swarsel-anki-deck nil)
(defvar swarsel-anki-notetype nil) ;; (defvar swarsel-anki-notetype nil)
(defvar swarsel-anki-fields nil) ;; (defvar swarsel-anki-fields nil)
(defun swarsel-anki-set-deck-and-notetype () ;; (defun swarsel-anki-set-deck-and-notetype ()
(interactive) ;; (interactive)
(setq swarsel-anki-deck (completing-read "Choose a deck: " ;; (setq swarsel-anki-deck (completing-read "Choose a deck: "
(sort (anki-editor-deck-names) #'string-lessp))) ;; (sort (anki-editor-deck-names) #'string-lessp)))
(setq swarsel-anki-notetype (completing-read "Choose a note type: " ;; (setq swarsel-anki-notetype (completing-read "Choose a note type: "
(sort (anki-editor-note-types) #'string-lessp))) ;; (sort (anki-editor-note-types) #'string-lessp)))
(setq swarsel-anki-fields (progn ;; (setq swarsel-anki-fields (progn
(anki-editor--anki-connect-invoke-result "modelFieldNames" `((modelName . ,swarsel-anki-notetype))))) ;; (anki-editor--anki-connect-invoke-result "modelFieldNames" `((modelName . ,swarsel-anki-notetype)))))
) ;; )
(defun swarsel-anki-make-template-string () ;; (defun swarsel-anki-make-template-string ()
(if (not swarsel-anki-deck) ;; (if (not swarsel-anki-deck)
(call-interactively 'swarsel-anki-set-deck-and-notetype)) ;; (call-interactively 'swarsel-anki-set-deck-and-notetype))
(setq swarsel-temp swarsel-anki-fields) ;; (setq swarsel-temp swarsel-anki-fields)
(concat (concat "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: " swarsel-anki-notetype "\n:ANKI_DECK: " swarsel-anki-deck "\n:END:\n** ")(pop swarsel-temp) "\n%?\n** " (mapconcat 'identity swarsel-temp "\n\n** ") "\n\n")) ;; (concat (concat "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: " swarsel-anki-notetype "\n:ANKI_DECK: " swarsel-anki-deck "\n:END:\n** ")(pop swarsel-temp) "\n%?\n** " (mapconcat 'identity swarsel-temp "\n\n** ") "\n\n"))
(defun swarsel-today() ;; (defun swarsel-today()
(format-time-string "%Y-%m-%d")) ;; (format-time-string "%Y-%m-%d"))
(defun swarsel-obsidian-daily () ;; (defun swarsel-obsidian-daily ()
(interactive) ;; (interactive)
(if (not (file-exists-p (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))) ;; (if (not (file-exists-p (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)))
(write-region "" nil (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)) ;; (write-region "" nil (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))
) ;; )
(find-file (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))) ;; (find-file (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)))
#+end_src #+end_src
@ -2491,5 +2511,6 @@ Yep, none currently.
We need to add this last line, because otherwise gpg will crash on the most recent version when saving a .gpg file within emacs. We need to add this last line, because otherwise gpg will crash on the most recent version when saving a .gpg file within emacs.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq gc-cons-threshold (* 800 1000 ))
(fset 'epg-wait-for-status 'ignore) (fset 'epg-wait-for-status 'ignore)
#+end_src #+end_src

83
Nix.org
View file

@ -1164,7 +1164,7 @@ Also, I define some useful shell scripts here.
filebot filebot
gimp gimp
zoom-us zoom-us
nomacs # nomacs
libreoffice-qt libreoffice-qt
xournalpp xournalpp
obsidian obsidian
@ -1202,10 +1202,10 @@ Also, I define some useful shell scripts here.
speechd speechd
networkmanagerapplet networkmanagerapplet
psmisc # kill etc psmisc # kill etc
jq # used for searching the i3 tree in check<xxx>.sh files # jq # used for searching the i3 tree in check<xxx>.sh files
# specifically needed for anki # specifically needed for anki
mpv # mpv
anki-bin anki-bin
# dirvish file previews # dirvish file previews
@ -1235,11 +1235,11 @@ Also, I define some useful shell scripts here.
playerctl playerctl
pavucontrol pavucontrol
pamixer pamixer
gnome.gnome-clocks # gnome.gnome-clocks
wlogout # wlogout
jdiskreport # jdiskreport
syncthingtray syncthingtray
monitor # monitor
#keychain #keychain
qalculate-gtk qalculate-gtk
@ -1648,18 +1648,13 @@ As for the `home.sessionVariables`, it should be noted that environment variable
home.sessionVariables = { home.sessionVariables = {
EDITOR = "bash ~/.dotfiles/scripts/editor.sh"; EDITOR = "bash ~/.dotfiles/scripts/editor.sh";
GTK_THEME = "Arc-Dark"; EDITORBAK = "bash ~/.dotfiles/scripts/editor.sh";
# GTK_THEME = "Arc-Dark";
}; };
#+end_src #+end_src
** Programs ** Programs
Let Home Manager install and manage itself - this is needed.
Other programs:
*** General *** General
#+begin_src nix :tangle profiles/common/home.nix #+begin_src nix :tangle profiles/common/home.nix
@ -1669,10 +1664,25 @@ Other programs:
package = pkgs.pass.withExtensions (exts: [exts.pass-otp]); package = pkgs.pass.withExtensions (exts: [exts.pass-otp]);
}; };
# zsh Integration is enabled by default for these # zsh Integration is enabled by default for these
programs.bottom.enable = true;
programs.imv.enable = true;
programs.sioyek.enable = true;
programs.bat.enable = true;
programs.carapace.enable = true;
programs.wlogout.enable = true;
programs.swayr.enable = true;
programs.yt-dlp.enable = true;
programs.mpv.enable = true;
programs.jq.enable = true;
programs.nix-index.enable = true;
programs.ripgrep.enable = true;
programs.pandoc.enable = true;
programs.fzf.enable = true; programs.fzf.enable = true;
programs.direnv.enable = true; programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.zoxide.enable = true; programs.zoxide.enable = true;
programs.navi.enable = true;
programs.eza = { programs.eza = {
enable = true; enable = true;
enableAliases = true; enableAliases = true;
@ -1688,8 +1698,11 @@ Other programs:
aliases = { aliases = {
a = "add"; a = "add";
c = "commit"; c = "commit";
cl = "clone";
co = "checkout"; co = "checkout";
b = "branch"; b = "branch";
i = "init";
m = "merge";
s = "status"; s = "status";
r = "restore"; r = "restore";
p = "pull"; p = "pull";
@ -1902,6 +1915,10 @@ zsh is clearly the most convenient shell for me and it happens to be super neat
size = 10000; size = 10000;
}; };
historySubstringSearch.enable = true; historySubstringSearch.enable = true;
initExtra = ''
bindkey "^[D" backward-word
bindkey "^[C" forward-word
'';
}; };
#+end_src #+end_src
@ -2052,6 +2069,18 @@ zsh is clearly the most convenient shell for me and it happens to be super neat
packageRequires = [ epkgs.howm ]; packageRequires = [ epkgs.howm ];
}) })
(epkgs.trivialBuild rec {
pname = "fast-scroll";
version = "1.0.0-20191016";
src = pkgs.fetchFromGitHub {
owner = "ahungry";
repo = "fast-scroll";
rev = "3f6ca0d5556fe9795b74714304564f2295dcfa24";
hash = "sha256-w1wmJW7YwXyjvXJOWdN2+k+QmhXr4IflES/c2bCX3CI=";
};
packageRequires = [];
})
]; ];
}); });
}; };
@ -2157,14 +2186,14 @@ Again I am just using the first bar option here that I was able to find good und
min-length= 8; min-length= 8;
interval= 1; interval= 1;
format= "{:%H:%M:%S}"; format= "{:%H:%M:%S}";
on-click-right= "gnome-clocks"; # on-click-right= "gnome-clocks";
tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>\n\nR:Clocks"; tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
}; };
"clock#2"= { "clock#2"= {
format= "{:%d. %B %Y}"; format= "{:%d. %B %Y}";
on-click-right= "gnome-clocks"; # on-click-right= "gnome-clocks";
tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>\n\nR:Clocks"; tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
}; };
@ -2192,7 +2221,8 @@ Again I am just using the first bar option here that I was able to find good und
min-length= 6; min-length= 6;
interval= 5; interval= 5;
format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"]; format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"];
on-click-right= "com.github.stsdc.monitor"; # on-click-right= "com.github.stsdc.monitor";
on-click-right= "kitty -o confirm_os_window_close=0 btm";
}; };
battery= { battery= {
@ -2716,7 +2746,9 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded
"${modifier}+Space" = "exec fuzzel"; "${modifier}+Space" = "exec fuzzel";
"${modifier}+Shift+Space" = "floating toggle"; "${modifier}+Shift+Space" = "floating toggle";
"${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\""; "${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\"";
"${modifier}+Shift+m" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\""; "${modifier}+Shift+m" = "exec emacsclient -nquc -a emacs -e \"(mu4e)\"";
"${modifier}+Shift+c" = "exec emacsclient -nquc -a emacs -e \"(swarsel/open-calendar)\"";
"${modifier}+Shift+s" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\"";
"${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\""; "${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\"";
"${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\""; "${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\"";
"${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\""; "${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\"";
@ -2727,7 +2759,8 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded
"${modifier}+p" = "exec pass-fuzzel"; "${modifier}+p" = "exec pass-fuzzel";
"${modifier}+Shift+p" = "exec pass-fuzzel --type"; "${modifier}+Shift+p" = "exec pass-fuzzel --type";
"${modifier}+Escape" = "mode $exit"; "${modifier}+Escape" = "mode $exit";
"${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor"; # "${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor";
"${modifier}+Shift+Escape" = "exec kitty -o confirm_os_window_close=0 btm";
"${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png"; "${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
"${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\""; "${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\"";
"${modifier}+1" = "workspace 1:一"; "${modifier}+1" = "workspace 1:一";
@ -2768,7 +2801,7 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded
"${modifier}+Shift+l" = "move right 40px"; "${modifier}+Shift+l" = "move right 40px";
"${modifier}+Shift+j" = "move down 40px"; "${modifier}+Shift+j" = "move down 40px";
"${modifier}+Shift+k" = "move up 40px"; "${modifier}+Shift+k" = "move up 40px";
"${modifier}+Shift+c" = "reload"; "${modifier}+Ctrl+Shift+c" = "reload";
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+r" = "mode resize"; "${modifier}+r" = "mode resize";
"${modifier}+Return" = "exec kitty"; "${modifier}+Return" = "exec kitty";
@ -2786,7 +2819,7 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded
defaultWorkspace = "workspace 1:一"; defaultWorkspace = "workspace 1:一";
startup = [ startup = [
{ command = "kitty -T kittyterm";} { command = "kitty -T kittyterm";}
{ command = "sleep 60; kitty -T spotifytui spt";} { command = "sleep 60; kitty -T spotifytui -o confirm_os_window_close=0 spt";}
]; ];
window = { window = {
border = 1; border = 1;

View file

@ -7,7 +7,7 @@
filebot filebot
gimp gimp
zoom-us zoom-us
nomacs # nomacs
libreoffice-qt libreoffice-qt
xournalpp xournalpp
obsidian obsidian
@ -45,10 +45,10 @@
speechd speechd
networkmanagerapplet networkmanagerapplet
psmisc # kill etc psmisc # kill etc
jq # used for searching the i3 tree in check<xxx>.sh files # jq # used for searching the i3 tree in check<xxx>.sh files
# specifically needed for anki # specifically needed for anki
mpv # mpv
anki-bin anki-bin
# dirvish file previews # dirvish file previews
@ -78,11 +78,11 @@
playerctl playerctl
pavucontrol pavucontrol
pamixer pamixer
gnome.gnome-clocks # gnome.gnome-clocks
wlogout # wlogout
jdiskreport # jdiskreport
syncthingtray syncthingtray
monitor # monitor
#keychain #keychain
qalculate-gtk qalculate-gtk
@ -440,7 +440,8 @@ home.file = {
home.sessionVariables = { home.sessionVariables = {
EDITOR = "bash ~/.dotfiles/scripts/editor.sh"; EDITOR = "bash ~/.dotfiles/scripts/editor.sh";
GTK_THEME = "Arc-Dark"; EDITORBAK = "bash ~/.dotfiles/scripts/editor.sh";
# GTK_THEME = "Arc-Dark";
}; };
programs.password-store = { programs.password-store = {
@ -448,10 +449,25 @@ programs.password-store = {
package = pkgs.pass.withExtensions (exts: [exts.pass-otp]); package = pkgs.pass.withExtensions (exts: [exts.pass-otp]);
}; };
# zsh Integration is enabled by default for these # zsh Integration is enabled by default for these
programs.bottom.enable = true;
programs.imv.enable = true;
programs.sioyek.enable = true;
programs.bat.enable = true;
programs.carapace.enable = true;
programs.wlogout.enable = true;
programs.swayr.enable = true;
programs.yt-dlp.enable = true;
programs.mpv.enable = true;
programs.jq.enable = true;
programs.nix-index.enable = true;
programs.ripgrep.enable = true;
programs.pandoc.enable = true;
programs.fzf.enable = true; programs.fzf.enable = true;
programs.direnv.enable = true; programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.zoxide.enable = true; programs.zoxide.enable = true;
programs.navi.enable = true;
programs.eza = { programs.eza = {
enable = true; enable = true;
enableAliases = true; enableAliases = true;
@ -467,8 +483,11 @@ programs.git = {
aliases = { aliases = {
a = "add"; a = "add";
c = "commit"; c = "commit";
cl = "clone";
co = "checkout"; co = "checkout";
b = "branch"; b = "branch";
i = "init";
m = "merge";
s = "status"; s = "status";
r = "restore"; r = "restore";
p = "pull"; p = "pull";
@ -652,6 +671,10 @@ programs.zsh = {
size = 10000; size = 10000;
}; };
historySubstringSearch.enable = true; historySubstringSearch.enable = true;
initExtra = ''
bindkey "^[D" backward-word
bindkey "^[C" forward-word
'';
}; };
programs.mbsync = { programs.mbsync = {
@ -790,6 +813,18 @@ programs.emacs = {
packageRequires = [ epkgs.howm ]; packageRequires = [ epkgs.howm ];
}) })
(epkgs.trivialBuild rec {
pname = "fast-scroll";
version = "1.0.0-20191016";
src = pkgs.fetchFromGitHub {
owner = "ahungry";
repo = "fast-scroll";
rev = "3f6ca0d5556fe9795b74714304564f2295dcfa24";
hash = "sha256-w1wmJW7YwXyjvXJOWdN2+k+QmhXr4IflES/c2bCX3CI=";
};
packageRequires = [];
})
]; ];
}); });
}; };
@ -887,14 +922,14 @@ programs.waybar = {
min-length= 8; min-length= 8;
interval= 1; interval= 1;
format= "{:%H:%M:%S}"; format= "{:%H:%M:%S}";
on-click-right= "gnome-clocks"; # on-click-right= "gnome-clocks";
tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>\n\nR:Clocks"; tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
}; };
"clock#2"= { "clock#2"= {
format= "{:%d. %B %Y}"; format= "{:%d. %B %Y}";
on-click-right= "gnome-clocks"; # on-click-right= "gnome-clocks";
tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>\n\nR:Clocks"; tooltip-format= "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
}; };
@ -922,7 +957,8 @@ programs.waybar = {
min-length= 6; min-length= 6;
interval= 5; interval= 5;
format-icons = ["" "" "" "" "" "" "" ""]; format-icons = ["" "" "" "" "" "" "" ""];
on-click-right= "com.github.stsdc.monitor"; # on-click-right= "com.github.stsdc.monitor";
on-click-right= "kitty -o confirm_os_window_close=0 btm";
}; };
battery= { battery= {
@ -1408,7 +1444,9 @@ wayland.windowManager.sway = {
"${modifier}+Space" = "exec fuzzel"; "${modifier}+Space" = "exec fuzzel";
"${modifier}+Shift+Space" = "floating toggle"; "${modifier}+Shift+Space" = "floating toggle";
"${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\""; "${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\"";
"${modifier}+Shift+m" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\""; "${modifier}+Shift+m" = "exec emacsclient -nquc -a emacs -e \"(mu4e)\"";
"${modifier}+Shift+c" = "exec emacsclient -nquc -a emacs -e \"(swarsel/open-calendar)\"";
"${modifier}+Shift+s" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\"";
"${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\""; "${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\"";
"${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\""; "${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\"";
"${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\""; "${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\"";
@ -1419,7 +1457,8 @@ wayland.windowManager.sway = {
"${modifier}+p" = "exec pass-fuzzel"; "${modifier}+p" = "exec pass-fuzzel";
"${modifier}+Shift+p" = "exec pass-fuzzel --type"; "${modifier}+Shift+p" = "exec pass-fuzzel --type";
"${modifier}+Escape" = "mode $exit"; "${modifier}+Escape" = "mode $exit";
"${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor"; # "${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor";
"${modifier}+Shift+Escape" = "exec kitty -o confirm_os_window_close=0 btm";
"${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png"; "${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
"${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\""; "${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\"";
"${modifier}+1" = "workspace 1:"; "${modifier}+1" = "workspace 1:";
@ -1460,7 +1499,7 @@ wayland.windowManager.sway = {
"${modifier}+Shift+l" = "move right 40px"; "${modifier}+Shift+l" = "move right 40px";
"${modifier}+Shift+j" = "move down 40px"; "${modifier}+Shift+j" = "move down 40px";
"${modifier}+Shift+k" = "move up 40px"; "${modifier}+Shift+k" = "move up 40px";
"${modifier}+Shift+c" = "reload"; "${modifier}+Ctrl+Shift+c" = "reload";
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+r" = "mode resize"; "${modifier}+r" = "mode resize";
"${modifier}+Return" = "exec kitty"; "${modifier}+Return" = "exec kitty";
@ -1478,7 +1517,7 @@ wayland.windowManager.sway = {
defaultWorkspace = "workspace 1:"; defaultWorkspace = "workspace 1:";
startup = [ startup = [
{ command = "kitty -T kittyterm";} { command = "kitty -T kittyterm";}
{ command = "sleep 60; kitty -T spotifytui spt";} { command = "sleep 60; kitty -T spotifytui -o confirm_os_window_close=0 spt";}
]; ];
window = { window = {
border = 1; border = 1;

View file

@ -3,18 +3,11 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(browse-url-browser-function 'browse-url-firefox)
'(custom-safe-themes '(custom-safe-themes
'("7ec8fd456c0c117c99e3a3b16aaf09ed3fb91879f6601b1ea0eeaee9c6def5d9" '("7ec8fd456c0c117c99e3a3b16aaf09ed3fb91879f6601b1ea0eeaee9c6def5d9"
"badd1a5e20bd0c29f4fe863f3b480992c65ef1fa63951f59aa5d6b129a3f9c4c" "badd1a5e20bd0c29f4fe863f3b480992c65ef1fa63951f59aa5d6b129a3f9c4c"
"2e05569868dc11a52b08926b4c1a27da77580daa9321773d92822f7a639956ce" "2e05569868dc11a52b08926b4c1a27da77580daa9321773d92822f7a639956ce"
default)) default)))
'(org-agenda-files '("/home/swarsel/Calendars/leon_cal.org"))
'(send-mail-function 'sendmail-send-it)
'(warning-suppress-log-types
'(((python python-shell-completion-native-turn-on-maybe)) (comp)
((defvaralias losing-value org-tab-first-hook))))
'(warning-suppress-types '(((defvaralias losing-value org-tab-first-hook)))))
;; (custom-set-faces ;; (custom-set-faces
;; ;; custom-set-faces was added by Custom. ;; ;; custom-set-faces was added by Custom.
;; ;; If you edit it by hand, you could mess it up, so be careful. ;; ;; If you edit it by hand, you could mess it up, so be careful.
@ -36,10 +29,7 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(evil-goggles-change-face ((t (:inherit diff-removed)))) '(highlight-indent-guides-even-face ((t (:background "gray10"))))
'(evil-goggles-delete-face ((t (:inherit diff-removed)))) '(highlight-indent-guides-odd-face ((t (:background "gray20"))))
'(evil-goggles-paste-face ((t (:inherit diff-added)))) '(highlight-indent-guides-stack-even-face ((t (:background "gray40"))))
'(evil-goggles-undo-redo-add-face ((t (:inherit diff-added)))) '(highlight-indent-guides-stack-odd-face ((t (:background "gray50")))))
'(evil-goggles-undo-redo-change-face ((t (:inherit diff-changed))))
'(evil-goggles-undo-redo-remove-face ((t (:inherit diff-removed))))
'(evil-goggles-yank-face ((t (:inherit diff-changed)))))

View file

@ -1,5 +1,4 @@
;; The default is 800 kilobytes. Measured in bytes. ;; The default is 800 kilobytes. Measured in bytes.
(setq gc-cons-threshold (* 50 1000 1000))
;; use UTF-8 everywhere ;; use UTF-8 everywhere
(set-language-environment "UTF-8") (set-language-environment "UTF-8")
@ -62,25 +61,26 @@
(load custom-file t) (load custom-file t)
(defalias 'yes-or-no-p 'y-or-n-p) (defalias 'yes-or-no-p 'y-or-n-p)
;;(setq-default show-trailing-whitespace t) ;;(setq-default show-trailing-whitespace t)
(add-hook 'before-save-hook 'delete-trailing-whitespace) (add-hook 'before-save-hook 'delete-trailing-whitespace)
(global-hl-line-mode 1) (global-hl-line-mode 1)
;; (setq redisplay-dont-pause t) ;; obsolete ;; (setq redisplay-dont-pause t) ;; obsolete
(delete-selection-mode 1) (setq blink-cursor-mode nil) ;; blink-cursor is an unexpected source of slowdown
(pixel-scroll-precision-mode 1) (delete-selection-mode 1)
(setq vc-follow-symlinks t) (setq vc-follow-symlinks t)
(setq require-final-newline t) (setq require-final-newline t)
(winner-mode 1) (winner-mode 1)
;; less noise when compiling elisp ;; less noise when compiling elisp
(setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local)) (setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local))
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)
(setq load-prefer-newer t) (setq load-prefer-newer t)
;; disable a keybind that does more harm than good (setq browse-url-browser-function 'browse-url-firefox)
(global-set-key [remap suspend-frame] ;; disable a keybind that does more harm than good
(lambda () (global-set-key [remap suspend-frame]
(interactive) (lambda ()
(message "This keybinding is disabled (was 'suspend-frame')"))) (interactive)
(message "This keybinding is disabled (was 'suspend-frame')")))
;; (scroll-bar-mode -1) ;; (scroll-bar-mode -1)
;; (tool-bar-mode -1) ;; (tool-bar-mode -1)
@ -91,21 +91,37 @@
initial-scratch-message nil) initial-scratch-message nil)
(setq-default indent-tabs-mode nil (setq-default indent-tabs-mode nil
tab-width 2) tab-width 2)
(setq tab-always-indent 'complete) (setq tab-always-indent 'complete)
;; dont send nag when creating python files
(setq python-indent-guess-indent-offset-verbose nil)
(use-package highlight-indent-guides (use-package highlight-indent-guides
:hook (prog-mode . highlight-indent-guides-mode) :hook (prog-mode . highlight-indent-guides-mode)
:init :init
(setq highlight-indent-guides-method 'character) (setq highlight-indent-guides-method 'column)
(setq highlight-indent-guides-character "|") ;; (setq highlight-indent-guides-method 'character)
;; (setq highlight-indent-guides-character ?|)
(setq highlight-indent-guides-responsive 'top) (setq highlight-indent-guides-responsive 'top)
) )
;;(set-face--background 'highlight-indent-guides-odd-face "dark slate gray")
;;(set-face-background 'highlight-indent-guides-even-face "steel blue")
;;(set-face-foreground 'highlight-indent-guides-character-face "dark violet")
(setq scroll-step 1 (setq scroll-step 1
scroll-margin 4 scroll-margin 4
scroll-conservatively 5) scroll-conservatively 101)
;; (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
;; (setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
;; (setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(pixel-scroll-precision-mode 1)
;; (use-package fast-scroll
;; :ensure nil
;; :init (fast-scroll-mode 1))
(defun swarsel/with-buffer-name-prompt-and-make-subdirs () (defun swarsel/with-buffer-name-prompt-and-make-subdirs ()
(let ((parent-directory (file-name-directory buffer-file-name))) (let ((parent-directory (file-name-directory buffer-file-name)))
@ -159,34 +175,22 @@
(evil-collection-init) (evil-collection-init)
(setq forge-add-default-bindings nil)) (setq forge-add-default-bindings nil))
;; enables 2-char inline search
(use-package evil-snipe (use-package evil-snipe
:after evil :after evil
:demand :demand
:config :config
(evil-snipe-mode +1) (evil-snipe-mode +1)
;; replace 1-char searches (f&t) with this better UI
(evil-snipe-override-mode +1)) (evil-snipe-override-mode +1))
;; for parentheses-heavy languades modify evil commands to keep balance of parantheses
(use-package evil-cleverparens) (use-package evil-cleverparens)
;; enables surrounding text with S
(use-package evil-surround) (use-package evil-surround
:config
(use-package evil-goggles (global-evil-surround-mode 1))
:after evil
:demand
:init
(setq evil-goggles-duration 0.05)
:config
(push '(evil-operator-eval
:face evil-goggles-yank-face
:switch evil-goggles-enable-yank
:advice evil-goggles--generic-async-advice)
evil-goggles--commands)
(evil-goggles-mode)
(evil-goggles-use-diff-faces)
)
(use-package undo-tree (use-package undo-tree
;; :init (global-undo-tree-mode) ;; :init (global-undo-tree-mode)
@ -235,6 +239,7 @@
"t" '(:ignore t :which-key "toggles") "t" '(:ignore t :which-key "toggles")
"ts" '(hydra-text-scale/body :which-key "scale text") "ts" '(hydra-text-scale/body :which-key "scale text")
"tl" '(display-line-numbers-mode :which-key "line numbers") "tl" '(display-line-numbers-mode :which-key "line numbers")
"tp" '(evil-cleverparens-mode :wk "cleverparens")
"to" '(olivetti-mode :wk "olivetti") "to" '(olivetti-mode :wk "olivetti")
"td" '(darkroom-tentative-mode :wk "darkroom") "td" '(darkroom-tentative-mode :wk "darkroom")
"tw" '((lambda () (interactive) (toggle-truncate-lines)) :which-key "line wrapping") "tw" '((lambda () (interactive) (toggle-truncate-lines)) :which-key "line wrapping")
@ -244,21 +249,21 @@
"mc" '((lambda () (interactive) (swarsel/open-calendar)) :which-key "calendar") "mc" '((lambda () (interactive) (swarsel/open-calendar)) :which-key "calendar")
"mp" '(popper-toggle :which-key "popper") "mp" '(popper-toggle :which-key "popper")
"md" '(dirvish :which-key "dirvish") "md" '(dirvish :which-key "dirvish")
"c" '(:ignore c :which-key "capture") ;; "c" '(:ignore c :which-key "capture")
"cj" '((lambda () (interactive) (org-capture nil "jj")) :which-key "journal") ;; "cj" '((lambda () (interactive) (org-capture nil "jj")) :which-key "journal")
"cs" '(markdown-download-screenshot :which-key "screenshot") ;; "cs" '(markdown-download-screenshot :which-key "screenshot")
"l" '(:ignore l :which-key "links") "l" '(:ignore l :which-key "links")
"le" '((lambda () (interactive) (find-file swarsel-emacs-org-filepath)) :which-key "Emacs.org") "le" '((lambda () (interactive) (find-file swarsel-emacs-org-filepath)) :which-key "Emacs.org")
"ls" '((lambda () (interactive) (find-file "/smb:Swarsel@192.168.1.3:")) :which-key "Server") "ls" '((lambda () (interactive) (find-file "/smb:Swarsel@192.168.1.3:")) :which-key "Server")
"lo" '(dired swarsel-obsidian-vault-directory :which-key "obsidian") "lo" '(dired swarsel-obsidian-vault-directory :which-key "obsidian")
"la" '((lambda () (interactive) (find-file swarsel-org-anki-filepath)) :which-key "anki") ;; "la" '((lambda () (interactive) (find-file swarsel-org-anki-filepath)) :which-key "anki")
"ln" '((lambda () (interactive) (find-file swarsel-nix-org-filepath)) :which-key "Nix.org") "ln" '((lambda () (interactive) (find-file swarsel-nix-org-filepath)) :which-key "Nix.org")
"lp" '((lambda () (interactive) (projectile-switch-project)) :which-key "switch project") "lp" '((lambda () (interactive) (projectile-switch-project)) :which-key "switch project")
"lg" '((lambda () (interactive) (magit-list-repositories)) :which-key "list git repos") "lg" '((lambda () (interactive) (magit-list-repositories)) :which-key "list git repos")
"a" '(:ignore a :which-key "anki") ;; "a" '(:ignore a :which-key "anki")
"ap" '(anki-editor-push-tree :which-key "push new cards") ;; "ap" '(anki-editor-push-tree :which-key "push new cards")
"an" '((lambda () (interactive) (org-capture nil "a")) :which-key "new card") ;; "an" '((lambda () (interactive) (org-capture nil "a")) :which-key "new card")
"as" '(swarsel-anki-set-deck-and-notetype :which-key "change deck and notetype") ;; "as" '(swarsel-anki-set-deck-and-notetype :which-key "change deck and notetype")
"h" '(:ignore h :which-key "help") "h" '(:ignore h :which-key "help")
"hy" '(yas-describe-tables :which-key "yas tables") "hy" '(yas-describe-tables :which-key "yas tables")
"hb" '(embark-bindings :which-key "current key bindings") "hb" '(embark-bindings :which-key "current key bindings")
@ -269,6 +274,7 @@
"hl" '(view-lossage :which-key "show command keypresses") "hl" '(view-lossage :which-key "show command keypresses")
"hL" 'find-library "hL" 'find-library
"hm" 'describe-mode "hm" 'describe-mode
"ho" 'describe-symbol
"hk" 'describe-key "hk" 'describe-key
"hK" 'describe-keymap "hK" 'describe-keymap
"hp" 'describe-package "hp" 'describe-package
@ -293,9 +299,9 @@
;; General often used hotkeys ;; General often used hotkeys
(general-define-key (general-define-key
"C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card "C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card
"C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist ;; "C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist
"C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetye for new anki cards ;; "C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetye for new anki cards
"C-M-s" 'markdown-download-screenshot ; wrapper for org-download-screenshot ;; "C-M-s" 'markdown-download-screenshot ; wrapper for org-download-screenshot
"C-c d" 'duplicate-line ; duplicate line on CURSOR "C-c d" 'duplicate-line ; duplicate line on CURSOR
"C-M-j" 'consult-buffer "C-M-j" 'consult-buffer
"C-s" 'consult-line "C-s" 'consult-line
@ -318,9 +324,6 @@
(use-package rainbow-mode (use-package rainbow-mode
:config (rainbow-mode)) :config (rainbow-mode))
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(add-hook 'prog-mode-hook 'display-line-numbers-mode) (add-hook 'prog-mode-hook 'display-line-numbers-mode)
@ -356,11 +359,15 @@
;; (add-hook 'after-make-frame-functions #'swarsel/font-setup) ;; (add-hook 'after-make-frame-functions #'swarsel/font-setup)
(use-package doom-themes
:init (load-theme 'doom-city-lights t))
(use-package solaire-mode (use-package solaire-mode
:init (solaire-global-mode +1)) :defer t
:custom (solaire-global-mode +1))
(use-package doom-themes
:defer t
:hook (server-after-make-frame . (lambda () (load-theme
'doom-city-lights t)))
)
;; (set-frame-parameter (selected-frame) 'alpha '(95 . 95)) ;; (set-frame-parameter (selected-frame) 'alpha '(95 . 95))
;; (add-to-list 'default-frame-alist '(alpha . (95 . 95))) ;; (add-to-list 'default-frame-alist '(alpha . (95 . 95)))
@ -607,11 +614,11 @@
;; (setq evil-auto-indent nil) ;; (setq evil-auto-indent nil)
;;(diminish org-indent-mode) ;;(diminish org-indent-mode)
(defun swarsel/org-font-setup () ;; (defun swarsel/org-font-setup ()
;; Replace list hyphen with dot ;; ;; Replace list hyphen with dot
(font-lock-add-keywords 'org-mode ;; (font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) " ;; '(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))))) ;; (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
(use-package org (use-package org
;;:diminish (org-indent-mode) ;;:diminish (org-indent-mode)
@ -622,9 +629,9 @@
org-hide-emphasis-markers t) org-hide-emphasis-markers t)
(setq org-startup-folded t) (setq org-startup-folded t)
(setq org-support-shift-select t) (setq org-support-shift-select t)
(setq org-agenda-start-with-log-mode t) ;; (setq org-agenda-start-with-log-mode t)
(setq org-log-done 'time) ;; (setq org-log-done 'time)
(setq org-log-into-drawer t) ;; (setq org-log-into-drawer t)
(setq org-startup-with-inline-images t) (setq org-startup-with-inline-images t)
(setq org-image-actual-width nil) (setq org-image-actual-width nil)
(setq org-format-latex-options '(:foreground "White" :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))) (setq org-format-latex-options '(:foreground "White" :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
@ -633,95 +640,95 @@
;; '(swarsel-org-tasks-filepath ;; '(swarsel-org-tasks-filepath
;; swarsel-org-archive-filepath ;; swarsel-org-archive-filepath
;; swarsel-org-anki-filepath)) ;; swarsel-org-anki-filepath))
(setq org-agenda-files '("/home/swarsel/Calendars/leon_cal.org"))
(setq org-agenda-files
'("~/Calendars/leon_cal.org"))
(require 'org-habit) ;; (require 'org-habit)
(add-to-list 'org-modules 'org-habit) ;; (add-to-list 'org-modules 'org-habit)
(setq org-habit-graph-column 60) ;; (setq org-habit-graph-column 60)
(setq org-todo-keywords ;; (setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") ;; '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
(sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)"))) ;; (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)")))
(setq org-refile-targets ;; (setq org-refile-targets
'((swarsel-archive-org-file :maxlevel . 1) ;; '((swarsel-archive-org-file :maxlevel . 1)
(swarsel-anki-org-file :maxlevel . 1) ;; (swarsel-anki-org-file :maxlevel . 1)
(swarsel-tasks-org-file :maxlevel . 1))) ;; (swarsel-tasks-org-file :maxlevel . 1)))
;; Configure custom agenda views ;; ;; Configure custom agenda views
(setq org-agenda-custom-commands ;; (setq org-agenda-custom-commands
'(("d" "Dashboard" ;; '(("d" "Dashboard"
((agenda "" ((org-deadline-warning-days 7))) ;; ((agenda "" ((org-deadline-warning-days 7)))
(todo "NEXT" ;; (todo "NEXT"
((org-agenda-overriding-header "Next Tasks"))) ;; ((org-agenda-overriding-header "Next Tasks")))
(tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects"))))) ;; (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects")))))
("n" "Next Tasks" ;; ("n" "Next Tasks"
((todo "NEXT" ;; ((todo "NEXT"
((org-agenda-overriding-header "Next Tasks"))))) ;; ((org-agenda-overriding-header "Next Tasks")))))
("W" "Work Tasks" tags-todo "+work-email") ;; ("W" "Work Tasks" tags-todo "+work-email")
;; Low-effort next actions ;; ;; Low-effort next actions
("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0" ;; ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0"
((org-agenda-overriding-header "Low Effort Tasks") ;; ((org-agenda-overriding-header "Low Effort Tasks")
(org-agenda-max-todos 20) ;; (org-agenda-max-todos 20)
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
("w" "Workflow Status" ;; ("w" "Workflow Status"
((todo "WAIT" ;; ((todo "WAIT"
((org-agenda-overriding-header "Waiting on External") ;; ((org-agenda-overriding-header "Waiting on External")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "REVIEW" ;; (todo "REVIEW"
((org-agenda-overriding-header "In Review") ;; ((org-agenda-overriding-header "In Review")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "PLAN" ;; (todo "PLAN"
((org-agenda-overriding-header "In Planning") ;; ((org-agenda-overriding-header "In Planning")
(org-agenda-todo-list-sublevels nil) ;; (org-agenda-todo-list-sublevels nil)
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "BACKLOG" ;; (todo "BACKLOG"
((org-agenda-overriding-header "Project Backlog") ;; ((org-agenda-overriding-header "Project Backlog")
(org-agenda-todo-list-sublevels nil) ;; (org-agenda-todo-list-sublevels nil)
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "READY" ;; (todo "READY"
((org-agenda-overriding-header "Ready for Work") ;; ((org-agenda-overriding-header "Ready for Work")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "ACTIVE" ;; (todo "ACTIVE"
((org-agenda-overriding-header "Active Projects") ;; ((org-agenda-overriding-header "Active Projects")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "COMPLETED" ;; (todo "COMPLETED"
((org-agenda-overriding-header "Completed Projects") ;; ((org-agenda-overriding-header "Completed Projects")
(org-agenda-files org-agenda-files))) ;; (org-agenda-files org-agenda-files)))
(todo "CANC" ;; (todo "CANC"
((org-agenda-overriding-header "Cancelled Projects") ;; ((org-agenda-overriding-header "Cancelled Projects")
(org-agenda-files org-agenda-files))))))) ;; (org-agenda-files org-agenda-files)))))))
(setq org-capture-templates ;; (setq org-capture-templates
`( ;; `(
("a" "Anki basic" ;; ("a" "Anki basic"
entry ;; entry
(file+headline swarsel-org-anki-filepath "Dispatch") ;; (file+headline swarsel-org-anki-filepath "Dispatch")
(function swarsel-anki-make-template-string)) ;; (function swarsel-anki-make-template-string))
("A" "Anki cloze" ;; ("A" "Anki cloze"
entry ;; entry
(file+headline org-swarsel-anki-file "Dispatch") ;; (file+headline org-swarsel-anki-file "Dispatch")
"* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Cloze\n:ANKI_DECK: 🦁 All::01 ❤️ Various::00 ✨ Allgemein\n:END:\n** Text\n%?\n** Extra\n") ;; "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Cloze\n:ANKI_DECK: 🦁 All::01 ❤️ Various::00 ✨ Allgemein\n:END:\n** Text\n%?\n** Extra\n")
("t" "Tasks / Projects") ;; ("t" "Tasks / Projects")
("tt" "Task" entry (file+olp swarsel-org-tasks-filepath "Inbox") ;; ("tt" "Task" entry (file+olp swarsel-org-tasks-filepath "Inbox")
"* TODO %?\n %U\n %a\n %i" :empty-lines 1) ;; "* TODO %?\n %U\n %a\n %i" :empty-lines 1)
("j" "Journal Entries") ;; ("j" "Journal Entries")
("jj" "Journal" entry ;; ("jj" "Journal" entry
(file+olp+datetree swarsel-org-journal-filepath) ;; (file+olp+datetree swarsel-org-journal-filepath)
"\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n" ;; "\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org") ;; ;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org")
:clock-in :clock-resume ;; :clock-in :clock-resume
:empty-lines 1))) ;; :empty-lines 1)))
(swarsel/org-font-setup)) ;; (swarsel/org-font-setup)
)
;; ;; Set faces for heading levels ;; ;; Set faces for heading levels
;; (with-eval-after-load 'org-faces (dolist (face '((org-level-1 . 1.3) ;; (with-eval-after-load 'org-faces (dolist (face '((org-level-1 . 1.3)
@ -743,18 +750,18 @@
;; (set-face-attribute 'org-checkbox nil :inherit '(fixed-pitch))) ;; (set-face-attribute 'org-checkbox nil :inherit '(fixed-pitch)))
;; Show hidden emphasis markers ;; Show hidden emphasis markers
(use-package org-appear ;; (use-package org-appear
:hook (org-mode . org-appear-mode) ;; :hook (org-mode . org-appear-mode)
:init ;; :init
(setq org-appear-autolinks t) ;; (setq org-appear-autolinks t)
(setq org-appear-autosubmarkers t) ;; (setq org-appear-autosubmarkers t)
) ;; )
(use-package org-bullets ;; (use-package org-bullets
:after org ;; :after org
:hook (org-mode . org-bullets-mode) ;; :hook (org-mode . org-bullets-mode)
:custom ;; :custom
(org-bullets-bullet-list '("" "" "" "" "" "" ""))) ;; (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
(defun swarsel/org-mode-visual-fill () (defun swarsel/org-mode-visual-fill ()
(setq visual-fill-column-width 150 (setq visual-fill-column-width 150
@ -868,104 +875,104 @@
;; these next lines provide an interface for org-download in markdown mode for use with obsidian ;; these next lines provide an interface for org-download in markdown mode for use with obsidian
(defvar org-download-markdown-link-format ;; (defvar org-download-markdown-link-format
"![[./%s]]\n" ;; "![[./%s]]\n"
"Format of the file link to insert.") ;; "Format of the file link to insert.")
(defcustom org-download-markdown-link-format-function #'org-download-markdown-link-format-function-default ;; (defcustom org-download-markdown-link-format-function #'org-download-markdown-link-format-function-default
"Function that takes FILENAME and returns a org link." ;; "Function that takes FILENAME and returns a org link."
:type 'function) ;; :type 'function)
(defun org-download-markdown-link-format-function-default (filename) ;; (defun org-download-markdown-link-format-function-default (filename)
"The default function of `org-download-link-format-function'." ;; "The default function of `org-download-link-format-function'."
(if (and (>= (string-to-number org-version) 9.3) ;; (if (and (>= (string-to-number org-version) 9.3)
(eq org-download-method 'attach)) ;; (eq org-download-method 'attach))
(format "[[attachment:%s]]\n" ;; (format "[[attachment:%s]]\n"
(org-link-escape ;; (org-link-escape
(file-relative-name filename (org-attach-dir)))) ;; (file-relative-name filename (org-attach-dir))))
(format org-download-markdown-link-format ;; (format org-download-markdown-link-format
(org-link-escape ;; (org-link-escape
(funcall org-download-abbreviate-filename-function filename))))) ;; (funcall org-download-abbreviate-filename-function filename)))))
(defun org-download-markdown-image (link) ;; (defun org-download-markdown-image (link)
"Save image at address LINK to `org-download--dir'." ;; "Save image at address LINK to `org-download--dir'."
(interactive "sUrl: ") ;; (interactive "sUrl: ")
(let* ((link-and-ext (org-download--parse-link link)) ;; (let* ((link-and-ext (org-download--parse-link link))
(filename ;; (filename
(cond ((and (derived-mode-p 'org-mode) ;; (cond ((and (derived-mode-p 'org-mode)
(eq org-download-method 'attach)) ;; (eq org-download-method 'attach))
(let ((org-download-image-dir (org-attach-dir t)) ;; (let ((org-download-image-dir (org-attach-dir t))
org-download-heading-lvl) ;; org-download-heading-lvl)
(apply #'org-download--fullname link-and-ext))) ;; (apply #'org-download--fullname link-and-ext)))
((fboundp org-download-method) ;; ((fboundp org-download-method)
(funcall org-download-method link)) ;; (funcall org-download-method link))
(t ;; (t
(apply #'org-download--fullname link-and-ext))))) ;; (apply #'org-download--fullname link-and-ext)))))
(setq org-download-path-last-file filename) ;; (setq org-download-path-last-file filename)
(org-download--image link filename) ;; (org-download--image link filename)
(when (org-download-org-mode-p) ;; (when (org-download-org-mode-p)
(when (eq org-download-method 'attach) ;; (when (eq org-download-method 'attach)
(org-attach-attach filename nil 'none)) ;; (org-attach-attach filename nil 'none))
(org-download-markdown-insert-link link filename)) ;; (org-download-markdown-insert-link link filename))
(when (and (eq org-download-delete-image-after-download t) ;; (when (and (eq org-download-delete-image-after-download t)
(not (url-handler-file-remote-p (current-kill 0)))) ;; (not (url-handler-file-remote-p (current-kill 0))))
(delete-file link delete-by-moving-to-trash)))) ;; (delete-file link delete-by-moving-to-trash))))
(defun org-download-markdown-screenshot (&optional basename) ;; (defun org-download-markdown-screenshot (&optional basename)
"Capture screenshot and insert the resulting file. ;; "Capture screenshot and insert the resulting file.
The screenshot tool is determined by `org-download-screenshot-method'." ;; The screenshot tool is determined by `org-download-screenshot-method'."
(interactive) ;; (interactive)
(let* ((screenshot-dir (file-name-directory org-download-screenshot-file)) ;; (let* ((screenshot-dir (file-name-directory org-download-screenshot-file))
(org-download-screenshot-file ;; (org-download-screenshot-file
(if basename ;; (if basename
(concat screenshot-dir basename) org-download-screenshot-file))) ;; (concat screenshot-dir basename) org-download-screenshot-file)))
(make-directory screenshot-dir t) ;; (make-directory screenshot-dir t)
(if (functionp org-download-screenshot-method) ;; (if (functionp org-download-screenshot-method)
(funcall org-download-screenshot-method ;; (funcall org-download-screenshot-method
org-download-screenshot-file) ;; org-download-screenshot-file)
(shell-command-to-string ;; (shell-command-to-string
(format org-download-screenshot-method ;; (format org-download-screenshot-method
org-download-screenshot-file))) ;; org-download-screenshot-file)))
(when (file-exists-p org-download-screenshot-file) ;; (when (file-exists-p org-download-screenshot-file)
(org-download-markdown-image org-download-screenshot-file) ;; (org-download-markdown-image org-download-screenshot-file)
(delete-file org-download-screenshot-file)))) ;; (delete-file org-download-screenshot-file))))
(defun org-download-markdown-insert-link (link filename) ;; (defun org-download-markdown-insert-link (link filename)
(let* ((beg (point)) ;; (let* ((beg (point))
(line-beg (line-beginning-position)) ;; (line-beg (line-beginning-position))
(indent (- beg line-beg)) ;; (indent (- beg line-beg))
(in-item-p (org-in-item-p)) ;; (in-item-p (org-in-item-p))
str) ;; str)
(if (looking-back "^[ \t]+" line-beg) ;; (if (looking-back "^[ \t]+" line-beg)
(delete-region (match-beginning 0) (match-end 0)) ;; (delete-region (match-beginning 0) (match-end 0))
(newline)) ;; (newline))
(insert (funcall org-download-annotate-function link)) ;; (insert (funcall org-download-annotate-function link))
(dolist (attr org-download-image-attr-list) ;; (dolist (attr org-download-image-attr-list)
(insert attr "\n")) ;; (insert attr "\n"))
(insert (if (= org-download-image-html-width 0) ;; (insert (if (= org-download-image-html-width 0)
"" ;; ""
(format "#+attr_html: :width %dpx\n" org-download-image-html-width))) ;; (format "#+attr_html: :width %dpx\n" org-download-image-html-width)))
(insert (if (= org-download-image-latex-width 0) ;; (insert (if (= org-download-image-latex-width 0)
"" ;; ""
(format "#+attr_latex: :width %dcm\n" org-download-image-latex-width))) ;; (format "#+attr_latex: :width %dcm\n" org-download-image-latex-width)))
(insert (if (= org-download-image-org-width 0) ;; (insert (if (= org-download-image-org-width 0)
"" ;; ""
(format "#+attr_org: :width %dpx\n" org-download-image-org-width))) ;; (format "#+attr_org: :width %dpx\n" org-download-image-org-width)))
(insert (funcall org-download-markdown-link-format-function filename)) ;; (insert (funcall org-download-markdown-link-format-function filename))
(org-download--display-inline-images) ;; (org-download--display-inline-images)
(setq str (buffer-substring-no-properties line-beg (point))) ;; (setq str (buffer-substring-no-properties line-beg (point)))
(when in-item-p ;; (when in-item-p
(indent-region line-beg (point) indent)) ;; (indent-region line-beg (point) indent))
str)) ;; str))
(defun markdown-download-screenshot () ;; (defun markdown-download-screenshot ()
(interactive) ;; (interactive)
(org-mode) ;; (org-mode)
(org-download-markdown-screenshot) ;; (org-download-markdown-screenshot)
(markdown-mode)) ;; (markdown-mode))
(add-hook 'markdown-mode-hook (lambda () (org-display-inline-images))) ;;(add-hook 'markdown-mode-hook (lambda () (org-display-inline-images)))
(use-package olivetti (use-package olivetti
:init :init
@ -1100,12 +1107,14 @@
(use-package highlight-parentheses (use-package highlight-parentheses
:config :config
(setq highlight-parentheses-colors nil) (setq highlight-parentheses-colors '("black" "white" "black" "black" "black" "black" "black"))
(setq highlight-parentheses-background-colors '("magenta" "blue" "cyan" "green" "yellow" "orange" "red")) (setq highlight-parentheses-background-colors '("magenta" "blue" "cyan" "green" "yellow" "orange" "red"))
(global-highlight-parentheses-mode t)) (global-highlight-parentheses-mode t))
(electric-pair-mode 1) (electric-pair-mode 1)
(setq electric-pair-preserve-balance nil) (setq electric-pair-preserve-balance nil)
;; don't try to be overly smart
(setq electric-pair-delete-adjacent-pairs nil)
;; don't skip newline when auto-pairing parenthesis ;; don't skip newline when auto-pairing parenthesis
(setq electric-pair-skip-whitespace-chars '(9 32)) (setq electric-pair-skip-whitespace-chars '(9 32))
@ -1141,7 +1150,7 @@
(corfu-cycle t) (corfu-cycle t)
(corfu-quit-no-match 'separator) (corfu-quit-no-match 'separator)
(corfu-separator ?\s) (corfu-separator ?\s)
(corfu-quit-no-match t) ;; (corfu-quit-no-match t)
(corfu-popupinfo-max-height 70) (corfu-popupinfo-max-height 70)
(corfu-popupinfo-delay '(0.5 . 0.2)) (corfu-popupinfo-delay '(0.5 . 0.2))
;; (corfu-preview-current 'insert) ; insert previewed candidate ;; (corfu-preview-current 'insert) ; insert previewed candidate
@ -1151,19 +1160,28 @@
:bind (:map corfu-map :bind (:map corfu-map
("M-SPC" . corfu-insert-separator) ("M-SPC" . corfu-insert-separator)
("<return>" . swarsel/corfu-normal-return) ("<return>" . swarsel/corfu-normal-return)
;; ("C-<return>" . swarsel/corfu-complete)
("S-<up>" . corfu-popupinfo-scroll-down) ("S-<up>" . corfu-popupinfo-scroll-down)
("S-<down>" . corfu-popupinfo-scroll-up) ("S-<down>" . corfu-popupinfo-scroll-up)
("C-<up>" . corfu-previous) ("C-<up>" . corfu-previous)
("C-<down>" . corfu-next) ("C-<down>" . corfu-next)
("<up>" . swarsel/corfu-quit-and-up) ("<up>" . swarsel/corfu-quit-and-up)
("<down>" . swarsel/corfu-quit-and-down)) ("<down>" . swarsel/corfu-quit-and-down))
) )
;; dont disrupt file navigation with completions ;; dont disrupt file navigation with completions
(defun swarsel/corfu-normal-return (&optional arg) (defun swarsel/corfu-normal-return (&optional arg)
(interactive) (interactive)
(corfu-complete) (corfu-quit)
(corfu-quit)) (newline)
)
;; (defun swarsel/corfu-complete (&optional arg)
;; (interactive)
;; (corfu-complete)
;; (newline)
;; )
(defun swarsel/corfu-quit-and-up (&optional arg) (defun swarsel/corfu-quit-and-up (&optional arg)
(interactive) (interactive)
@ -1213,15 +1231,15 @@
(add-to-list 'completion-at-point-functions #'cape-dabbrev) (add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-file) (add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-elisp-block) (add-to-list 'completion-at-point-functions #'cape-elisp-block)
;;(add-to-list 'completion-at-point-functions #'cape-history) ;; (add-to-list 'completion-at-point-functions #'cape-history)
;;(add-to-list 'completion-at-point-functions #'cape-keyword) ;; (add-to-list 'completion-at-point-functions #'cape-keyword)
;;(add-to-list 'completion-at-point-functions #'cape-tex) ;; (add-to-list 'completion-at-point-functions #'cape-tex)
;;(add-to-list 'completion-at-point-functions #'cape-sgml) ;; (add-to-list 'completion-at-point-functions #'cape-sgml)
;;(add-to-list 'completion-at-point-functions #'cape-rfc1345) ;; (add-to-list 'completion-at-point-functions #'cape-rfc1345)
;;(add-to-list 'completion-at-point-functions #'cape-abbrev) ;; (add-to-list 'completion-at-point-functions #'cape-abbrev)
;;(add-to-list 'completion-at-point-functions #'cape-dict) ;; (add-to-list 'completion-at-point-functions #'cape-dict)
;;(add-to-list 'completion-at-point-functions #'cape-elisp-symbol) (add-to-list 'completion-at-point-functions #'cape-elisp-symbol)
;;(add-to-list 'completion-at-point-functions #'cape-line) ;; (add-to-list 'completion-at-point-functions #'cape-line)
) )
;; (use-package rustic ;; (use-package rustic
@ -1628,91 +1646,91 @@
(use-package ein) (use-package ein)
(use-package obsidian ;; (use-package obsidian
:ensure t ;; :ensure t
:demand t ;; :demand t
:config ;; :config
(obsidian-specify-path swarsel-obsidian-vault-directory) ;; (obsidian-specify-path swarsel-obsidian-vault-directory)
(global-obsidian-mode t) ;; (global-obsidian-mode t)
:custom ;; :custom
;; This directory will be used for `obsidian-capture' if set. ;; ;; This directory will be used for `obsidian-capture' if set.
(obsidian-inbox-directory "Inbox") ;; (obsidian-inbox-directory "Inbox")
(bind-key (kbd "C-c M-o") 'obsidian-hydra/body 'obsidian-mode-map) ;; (bind-key (kbd "C-c M-o") 'obsidian-hydra/body 'obsidian-mode-map)
:bind (:map obsidian-mode-map ;; :bind (:map obsidian-mode-map
;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding. ;; ;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding.
("C-c C-o" . obsidian-follow-link-at-point) ;; ("C-c C-o" . obsidian-follow-link-at-point)
;; Jump to backlinks ;; ;; Jump to backlinks
("C-c C-b" . obsidian-backlink-jump) ;; ("C-c C-b" . obsidian-backlink-jump)
;; If you prefer you can use `obsidian-insert-link' ;; ;; If you prefer you can use `obsidian-insert-link'
("C-c C-l" . obsidian-insert-wikilink))) ;; ("C-c C-l" . obsidian-insert-wikilink)))
(use-package anki-editor ;; (use-package anki-editor
:after org ;; :after org
:bind (:map org-mode-map ;; :bind (:map org-mode-map
("<f12>" . anki-editor-cloze-region-auto-incr) ;; ("<f12>" . anki-editor-cloze-region-auto-incr)
("<f11>" . anki-editor-cloze-region-dont-incr) ;; ("<f11>" . anki-editor-cloze-region-dont-incr)
("<f10>" . anki-editor-reset-cloze-number) ;; ("<f10>" . anki-editor-reset-cloze-number)
("<f9>" . anki-editor-push-tree)) ;; ("<f9>" . anki-editor-push-tree))
:hook (org-capture-after-finalize . anki-editor-reset-cloze-number) ; Reset cloze-number after each capture. ;; :hook (org-capture-after-finalize . anki-editor-reset-cloze-number) ; Reset cloze-number after each capture.
:config ;; :config
(setq anki-editor-create-decks t ;; Allow anki-editor to create a new deck if it doesn't exist ;; (setq anki-editor-create-decks t ;; Allow anki-editor to create a new deck if it doesn't exist
anki-editor-org-tags-as-anki-tags t) ;; anki-editor-org-tags-as-anki-tags t)
(defun anki-editor-cloze-region-auto-incr (&optional arg) ;; (defun anki-editor-cloze-region-auto-incr (&optional arg)
"Cloze region without hint and increase card number." ;; "Cloze region without hint and increase card number."
(interactive) ;; (interactive)
(anki-editor-cloze-region swarsel-anki-editor-cloze-number "") ;; (anki-editor-cloze-region swarsel-anki-editor-cloze-number "")
(setq swarsel-anki-editor-cloze-number (1+ swarsel-anki-editor-cloze-number)) ;; (setq swarsel-anki-editor-cloze-number (1+ swarsel-anki-editor-cloze-number))
(forward-sexp)) ;; (forward-sexp))
(defun anki-editor-cloze-region-dont-incr (&optional arg) ;; (defun anki-editor-cloze-region-dont-incr (&optional arg)
"Cloze region without hint using the previous card number." ;; "Cloze region without hint using the previous card number."
(interactive) ;; (interactive)
(anki-editor-cloze-region (1- swarsel-anki-editor-cloze-number) "") ;; (anki-editor-cloze-region (1- swarsel-anki-editor-cloze-number) "")
(forward-sexp)) ;; (forward-sexp))
(defun anki-editor-reset-cloze-number (&optional arg) ;; (defun anki-editor-reset-cloze-number (&optional arg)
"Reset cloze number to ARG or 1" ;; "Reset cloze number to ARG or 1"
(interactive) ;; (interactive)
(setq swarsel-anki-editor-cloze-number (or arg 1))) ;; (setq swarsel-anki-editor-cloze-number (or arg 1)))
(defun anki-editor-push-tree () ;; (defun anki-editor-push-tree ()
"Push all notes under a tree." ;; "Push all notes under a tree."
(interactive) ;; (interactive)
(anki-editor-push-notes '(4)) ;; (anki-editor-push-notes '(4))
(anki-editor-reset-cloze-number)) ;; (anki-editor-reset-cloze-number))
;; Initialize ;; ;; Initialize
(anki-editor-reset-cloze-number) ;; (anki-editor-reset-cloze-number)
) ;; )
(require 'anki-editor) ;; (require 'anki-editor)
(defvar swarsel-anki-deck nil) ;; (defvar swarsel-anki-deck nil)
(defvar swarsel-anki-notetype nil) ;; (defvar swarsel-anki-notetype nil)
(defvar swarsel-anki-fields nil) ;; (defvar swarsel-anki-fields nil)
(defun swarsel-anki-set-deck-and-notetype () ;; (defun swarsel-anki-set-deck-and-notetype ()
(interactive) ;; (interactive)
(setq swarsel-anki-deck (completing-read "Choose a deck: " ;; (setq swarsel-anki-deck (completing-read "Choose a deck: "
(sort (anki-editor-deck-names) #'string-lessp))) ;; (sort (anki-editor-deck-names) #'string-lessp)))
(setq swarsel-anki-notetype (completing-read "Choose a note type: " ;; (setq swarsel-anki-notetype (completing-read "Choose a note type: "
(sort (anki-editor-note-types) #'string-lessp))) ;; (sort (anki-editor-note-types) #'string-lessp)))
(setq swarsel-anki-fields (progn ;; (setq swarsel-anki-fields (progn
(anki-editor--anki-connect-invoke-result "modelFieldNames" `((modelName . ,swarsel-anki-notetype))))) ;; (anki-editor--anki-connect-invoke-result "modelFieldNames" `((modelName . ,swarsel-anki-notetype)))))
) ;; )
(defun swarsel-anki-make-template-string () ;; (defun swarsel-anki-make-template-string ()
(if (not swarsel-anki-deck) ;; (if (not swarsel-anki-deck)
(call-interactively 'swarsel-anki-set-deck-and-notetype)) ;; (call-interactively 'swarsel-anki-set-deck-and-notetype))
(setq swarsel-temp swarsel-anki-fields) ;; (setq swarsel-temp swarsel-anki-fields)
(concat (concat "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: " swarsel-anki-notetype "\n:ANKI_DECK: " swarsel-anki-deck "\n:END:\n** ")(pop swarsel-temp) "\n%?\n** " (mapconcat 'identity swarsel-temp "\n\n** ") "\n\n")) ;; (concat (concat "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: " swarsel-anki-notetype "\n:ANKI_DECK: " swarsel-anki-deck "\n:END:\n** ")(pop swarsel-temp) "\n%?\n** " (mapconcat 'identity swarsel-temp "\n\n** ") "\n\n"))
(defun swarsel-today() ;; (defun swarsel-today()
(format-time-string "%Y-%m-%d")) ;; (format-time-string "%Y-%m-%d"))
(defun swarsel-obsidian-daily () ;; (defun swarsel-obsidian-daily ()
(interactive) ;; (interactive)
(if (not (file-exists-p (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))) ;; (if (not (file-exists-p (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)))
(write-region "" nil (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)) ;; (write-region "" nil (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))
) ;; )
(find-file (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))) ;; (find-file (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)))
(let ((mu4epath (let ((mu4epath
(concat (concat
@ -1871,4 +1889,5 @@
))) )))
(setq dashboard-projects-switch-function 'counsel-projectile-switch-project-by-name) (setq dashboard-projects-switch-function 'counsel-projectile-switch-project-by-name)
(setq gc-cons-threshold (* 800 1000 ))
(fset 'epg-wait-for-status 'ignore) (fset 'epg-wait-for-status 'ignore)