From 17ee228b123c199591042b17c85245ea6af8e388 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Thu, 6 Oct 2022 06:49:50 -0400 Subject: Move emacs config --- emacs/.config/emacs-kj/development.el | 7 ++ emacs/.config/emacs-kj/init.el | 158 +++++++++++++++++++++++++++++++--- 2 files changed, 153 insertions(+), 12 deletions(-) (limited to 'emacs/.config/emacs-kj') diff --git a/emacs/.config/emacs-kj/development.el b/emacs/.config/emacs-kj/development.el index 258e299..c454b44 100644 --- a/emacs/.config/emacs-kj/development.el +++ b/emacs/.config/emacs-kj/development.el @@ -14,3 +14,10 @@ ;; (add-hook 'eglot-managed-mode-hook (lambda () (eldoc-mode -1))) ) +(use-package markdown-mode + :ensure t + :mode ("README\\.md\\'" . gfm-mode) + :init (setq markdown-command "multimarkdown")) + +(use-package nix-mode + :mode "\\.nix\\'") diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el index db9a6c7..da6e202 100644 --- a/emacs/.config/emacs-kj/init.el +++ b/emacs/.config/emacs-kj/init.el @@ -1,8 +1,5 @@ ;;; -*- lexical-binding: t; -*- -;;; TODO -;; - Trailing whitespace visualization - (setq straight-check-for-modifications nil) (defvar bootstrap-version) (let ((bootstrap-file @@ -17,6 +14,11 @@ (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) +(setq user-full-name "KJ Orbekk" + user-mail-address "kj@orbekk.com") + +(server-start) + (defalias 'yes-or-no-p 'y-or-n-p) (straight-use-package 'use-package) @@ -82,6 +84,11 @@ :config (setq aw-dispatch-always t) (setq aw-keys '(?a ?o ?e ?u ?i ?d ?h ?t ?n ?s)) + ;; Make ace window more visible + ;; (custom-set-faces! + ;; '(aw-leading-char-face + ;; :foreground "white" :background "red" + ;; :weight bold :height 2.5 :box (:line-width 10 :color "red"))) ) (defun kj/split-window-below () @@ -98,6 +105,14 @@ (global-set-key (kbd "C-c a") #'kj/split-window-right) (global-set-key (kbd "C-c o") #'kj/split-window-below) +(use-package company + :bind (:map company-active-map + ("C-n" . company-select-next) + ("C-p" . company-select-previous)) + :config + (setq company-idle-delay nil) + (global-company-mode t)) + (use-package selectrum :init (selectrum-mode +1)) @@ -227,19 +242,19 @@ ;; Optionally configure preview. The default value ;; is 'any, such that any key triggers the preview. - ;; (setq consult-preview-key 'any) + (setq consult-preview-key '(:debounce 0.3 any)) ;; (setq consult-preview-key (kbd "M-.")) ;; (setq consult-preview-key (list (kbd "") (kbd ""))) ;; For some commands and buffer sources it is useful to configure the ;; :preview-key on a per-command basis using the `consult-customize' macro. - (consult-customize - consult-theme - :preview-key '(:debounce 0.2 any) - consult-ripgrep consult-git-grep consult-grep - consult-bookmark consult-recent-file consult-xref - consult--source-bookmark consult--source-recent-file - consult--source-project-recent-file - :preview-key (kbd "M-.")) + ;; (consult-customize + ;; consult-theme + ;; :preview-key '(:debounce 0.2 any) + ;; consult-ripgrep consult-git-grep consult-grep + ;; consult-bookmark consult-recent-file consult-xref + ;; consult--source-bookmark consult--source-recent-file + ;; consult--source-project-recent-file + ;; :preview-key (kbd "M-.")) ;; Optionally configure the narrowing key. ;; Both < and C-+ work reasonably well. @@ -414,3 +429,122 @@ tramp-default-method "ssh") (load-file (locate-user-emacs-file "development.el")) + +(setq math-additional-units + '((ZiB "1024 * EiB" "Zebibyte") + (EiB "1024 * PiB" "Exbibyte") + (PiB "1024 * TiB" "Pebibyte") + (TiB "1024 * GiB" "Tebibyte") + (GiB "1024 * MiB" "Gibibyte") + (MiB "1024 * KiB" "Mebibyte") + (KiB "1024 * B" "Kibibyte") + (B nil "Byte") + (Zib "1024 * ZiB" "Zebibit") + (Eib "1024 * PiB" "Exbibit") + (Pib "1024 * TiB" "Pebibit") + (Tib "1024 * GiB" "Tebibit") + (Gib "1024 * Mib" "Gibibit") + (Mib "1024 * Kib" "Mebibit") + (Kib "1024 * b" "Kibibit") + (b "B / 8" "Bit"))) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/org/") +(setq org-todo-keywords + '((sequence + "TODO(t)" "ACTIVE(a!)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) +(setq org-refile-use-outline-path nil) +(setq org-refile-targets '((nil . (:maxlevel . 2)))) +(setq org-log-into-drawer t) +(setq org-agenda-log-mode-items '(closed clock state)) +(setq org-agenda-start-day nil) +(setq org-agenda-block-separator nil) +(setq org-agenda-compact-blocks t) +(setq org-agenda-start-with-log-mode nil) +(setq org-habit-show-all-today t) +(setq org-agenda-time-grid '((daily today require-timed) (800 1600) "......" "----------------------")) +(setq org-roam-directory (concat org-directory "roam/")) +(setq-default org-agenda-files '()) +(dolist (file '("tasks.org" + "running-2022.org")) + (add-to-list 'org-agenda-files (concat org-roam-directory file))) +(setq org-roam-db-location (concat org-roam-directory "/org-roam.db")) +(setq org-export-with-toc nil) +(setq deft-directory org-directory) +(setq deft-recursive t) +;; Org html export +(setq org-html-htmlize-output-type 'css) +;; Website publish settings. +(defvar kj/publish-tag "publish") +(defvar kj/publish-directory "/ssh:orbekk@dragon.orbekk.com:/storage/srv/kj.orbekk.com") +(add-to-list 'org-modules 'org-habit) + +; (setq org-appear-autolinks t) +; (use-package! org-appear +; :hook (org-mode . org-appear-mode)) + +(setq org-log-done 'time) +(setq org-todo-keywords + '((sequence + "TODO(t)" ; A task that needs doing & is ready to do + "PROJ(p)" ; A project, which usually contains other tasks + "LOOP(r)" ; A recurring task + "STRT(s)" ; A task that is in progress + "WAIT(w)" ; Something external is holding up this task + "HOLD(h)" ; This task is paused/on hold because of me + "IDEA(i)" ; An unconfirmed and unapproved task or notion + "|" + "DONE(d!)" ; Task successfully completed + "KILL(k)") ; Task was cancelled, aborted or is no longer applicable + (sequence + "[ ](T)" ; A task that needs doing + "[-](S)" ; Task is in progress + "[?](W)" ; Task is being held up or paused + "|" + "[X](D)") ; Task was completed + (sequence + "|" + "OKAY(o)" + "YES(y)" + "NO(n)"))) + +(setq org-journal-file-type 'weekly) +(setq org-journal-dir org-roam-directory) +(setq org-journal-file-format "journal-%Y-%m-%d.org") +(setq org-journal-enable-agenda-integration t) +(defun kj/org-journal-init () + (interactive) + (save-excursion + (goto-char (point-min)) + (org-id-get-create) + (org-set-property "category" "journal"))) + +(defun kj/org-journal-file-header (time) + (format-time-string "#+title: Week of %F (%W)\n" + (org-journal--convert-time-to-file-type-time time))) +(setq org-journal-file-header #'kj/org-journal-file-header) +(add-hook 'org-journal-after-header-create-hook 'kj/org-journal-init) + +;; Low menu delay. +(setq which-key-idle-delay .5) + +;; Allow longer output in compilation buffer. +(setq comint-buffer-maximum-size 10000) + +;; Replace values in an alist from a list of replacements. +;; +;; Example: +;; (kj/assq-replace '((:a . 1)) '((:a . 2))) +(defun kj/assq-replace (replacements alist) + (let ((replace1 (lambda (aelem alist) + (cons aelem (assq-delete-all (car aelem) alist))))) + (if replacements + (kj/assq-replace (cdr replacements) + (funcall replace1 (car replacements) alist)) + alist))) + +(add-hook 'eshell-mode-hook + (lambda () + (setenv "PAGER" "cat")) + (setenv "EDITOR" "emacsclient")) -- cgit v1.2.3