emacs config

Table of Contents

important programs to load first

(tool-bar-mode -1)
(defvar emacs/default-font-size 240)
(add-to-list 'default-frame-alist '(font . "Agave Nerd Font Mono-24"))
(menu-bar-mode -1)
(tooltip-mode -1)
(set-fringe-mode 10)
(column-number-mode)
(global-display-line-numbers-mode t)
(dolist (mode '(org-mode-hook
                term-mode-hook
                eshell-mode-hook
                treemacs-mode-hook
                shell-mode-hook))
  (add-hook mode (lambda () (display-line-numbers-mode 0))))
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("org" . "https://orgmode.org/elpa/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))
(require 'package)
(package-initialize)
(setq my-packages
      '(ivy
        counsel
        json-mode
        projectile
        cider
        clojure-mode
        expand-region
        jinja2-mode
        magit
        markdown-mode
        paredit
        wrap-region
        yaml-mode
        elpy
        json-mode
        doom-themes
        all-the-icons
        all-the-icons-dired
        which-key
        ivy-rich
        helpful
        rainbow-delimiters
        evil
        evil-collection
        forge
        evil-nerd-commenter
        projectile
        counsel-projectile
        dap-mode
        typescript-mode
        company
        company-box
        term
        eterm-256color
        vterm
        eshell-git-prompt
        eshell
        apheleia
        pet
        lsp-ui
        doom-modeline
        org
        org-bullets
        nix-mode
        olivetti
        visual-fill-column
        page-break-lines
        nerd-icons
        ripgrep
        consult
        orderless
        marginalia
        embark
        prettier
        prettier-js
        prettier-rc
        js2-mode
        org-edna
        treemacs
        treemacs-evil
        treemacs-icons-dired
        treemacs-magit
        treemacs-persp
        treemacs-tab-bar
        treemacs-projectile))
(dolist (pkg my-packages)
  (unless (package-installed-p pkg)
    (package-install pkg)))
(unless package-archive-contents
  (package-refresh-contents))
(unless (package-installed-p 'use-package)
  (package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(setq standard-indent 2)

(defun lik/get-project-root ()
  (when (fboundp 'projectile-project-root)
    (projectile-project-root)))


ivy

(use-package ivy
  :diminish
  :bind (;("C-s" . swiper)
         :map ivy-minibuffer-map
         ("TAB" . ivy-alt-done)
         ("C-l" . ivy-alt-done)
         ("C-j" . ivy-next-line)
         ("C-k" . ivy-previous-line)
         :map ivy-switch-buffer-map
         ("C-k" . ivy-previous-line)
         ("C-l" . ivy-done)
         ("C-d" . ivy-switch-buffer-kill)
         :map ivy-reverse-i-search-map
         ("C-k" . ivy-previous-line)
         ("C-d" . ivy-reverse-i-search-kill))
  :config
  (ivy-mode 1))

all the icons and all the icons dired

(use-package all-the-icons
  :if (display-graphic-p)
  :commands all-the-icons-install-fonts
  :init
  (unless (find-font (font-spec :name "all-the-icons"))
    (all-the-icons-install-fonts t)))
(use-package all-the-icons-dired
  :if (display-graphic-p)
  :hook (dired-mode . all-the-icons-dired-mode))

doom modeline and themes

(use-package doom-modeline
  :ensure t
  :init (doom-modeline-mode 1)
  :custom ((doom-modeline-height 15)))

(use-package doom-themes
  :init (load-theme 'doom-tomorrow-night t))

which-key

(use-package which-key
  :init (which-key-mode)
  :diminish which-key-mode
  :config
  (setq which-key-idle-delay 1))

ivy-rich

(use-package ivy-rich
  :init
  (ivy-rich-mode 1))

counsel

(use-package counsel
  :bind (("C-M-j" . 'counssel-switch-buffer)
         :map minibuffer-local-map
         ("C-r" . 'counsel-minibuffer-history))
  :custom
  (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
  :config
  (counsel-mode 1))

helpful

(use-package helpful
  :custom
  (counsel-describe-function-function #'helpful-callable)
  (counsel-describe-variable-function #'helpful-variable)
  :bind
  ([remap describe-function] . counsel-describe-function)
  ([remap describe-command] . helpful-command)
  ([remap describe-variable] . counsel-describe-variable)
  ([remap describe-key] . helpful-key))

rainbow-delimiters

(use-package rainbow-delimiters
  :hook (prog-mode . rainbow-delimiters-mode))
(global-set-key (kbd "C-M-j") 'counsel-switch-buffer)
(global-set-key (kbd "C-M-k") 'dw/switch-to-browser-buffer)

dired and dired-single

(use-package dired
  :ensure nil
  :commands (dired dired-find-file)
  :bind (("C-x C-j" . dired-find-file))
  :custom ((dired-listing-switches "-agho --group-directories-first")))

(use-package dired-single
  :commands (dired dired-jump))

(use-package dired-open
  :commands (dired dired-jump)
  :config
  (setq dired-open-extensions '(("png" . "feh")
                                ("mkv" . "mpv"))))
(use-package dired-hide-dotfiles
  :hook (dired-mode . dired-hide-dotfiles-mode)
  :config
  (evil-collection-define-key 'normal 'dired-mode-map
                              "H" 'dired-hide-dotfiles-mode))
(setq gc-cons-threshold (* 2 1000 1000))

lsp-mode

      (defun efs/lsp-mode-setup ()
        (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
        (lsp-headerline-breadcrumb-mode))

      (use-package lsp-mode
        :commands (lsp lsp-deferred)
        :hook (lsp-mode . efs/lsp-mode-setup)
        :init
        (setq lsp-keymap-prefix "C-c l")

        :config
        (lsp-enable-which-key-integration t)
        (setq lsp-signature-auto-activate nil))

      (use-package lsp-ui
        :hook (lsp-mode . lsp-ui-mode)
        :custom
;        (lsp-ui-doc-delay 1)
        (lsp-ui-doc-position 'bottom))

      (use-package lsp-treemacs
         :after lsp)

      (use-package lsp-ivy
        :after lsp)


evil mode

(use-package evil
  :init
  (setq evil-want-integration t)
  (setq evil-want-keybinding nil)
  (setq evil-want-C-u-scroll t)
  (setq evil-want-C-i-jump nil)
  :config
  (evil-mode 1)
  (define-key evil-insert-state-map (kbd "C-g")  'evil-normal-state)
  (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join)
  (evil-global-set-key 'motion "j" 'evil-next-visual-line)
  (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
  (evil-set-initial-state 'messages-buffer-mode 'normal)
  (evil-set-initial-state 'dashboard-mode 'normal))

(use-package evil-collection
  :after evil
  :config
  (evil-collection-init))

magit

(use-package magit
  :commands (magit-status magit-get-current-branch)
  :custom
  (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
(global-set-key (kbd "C-M-;") 'magit-status)

forge

(use-package forge
  :after magit)

evil nerd commenter

(use-package evil-nerd-commenter
  :bind ("M-/" . evilnc-comment-or-uncomment-lines))

projectile

(use-package projectile
  :diminish projectile-mode
  :config (projectile-mode)
  :custom ((projectile-completion-system 'ivy))
  :bind ("C-M-p" . projectile-find-file)
  :bind-keymap
  ("C-c p" . projectile-command-map)
  :init
  (when (file-directory-p "~/Documents")
    (setq projectile-project-search-path '("~/Documents")))
  (setq projectile-switch-project-action #'projectile-dired))

(use-package counsel-projectile
  :disabled
  :after projectile
  :config (counsel-projectile-mode))

dap mode

(use-package dap-mode
  :commands dab-debug
  :config
  (require 'dap-node)
  (dap-node-setup)

  (general-define-key
   :keymaps 'lsp-mode-map
   :prefix lsp-keymap-prefix
   "d" '(dap-hydra t :wk "debugger")))

apheleia

(use-package apheleia
  :defines (apheleia-formatters apheleia-mode-alist)
  :hook (after-init . apheleia-global-mode)
  :config
  (setf (alist-get 'python-mode apheleia-mode-alist) '(ruff-isort ruff))
  (setf (alist-get 'python-ts-mode apheleia-mode-alist) '(ruff-isort ruff)))

eglot

(use-package eglot
  :hook (python-base-mode . eglot-ensure)
  :custom (eglot-autopshutdown t))

python stuff

(use-package python-mode
  :hook (python-mode . lsp-deferred)
  :custom
  (dap-python-debugger 'debugpy)
  :config
  (require 'dap-python))

(use-package pyvenv
  :after python-mode
  :config
  (pyvenv-mode 1))

typescript

(use-package typescript-mode
  :mode "\\.ts\\'"
  :hook (typescript-mode .lsp-deferred)
  :config
  (setq typescript-indent-level 2))

company

(use-package company
  :after lsp-mode
  :hook (lsp-mode . company-mode)
  :bind (:map company-active-map
              ("<tab>" . company-complete-selection))
  (:map lsp-mode-map
        ("<tab>" . company-indent-or-complete-common))
  :custom
  (company-minimum-prefix-length 1)
  (company-idle-delay nil))

(use-package company-box
  :hook (company-mode . company-box-mode))

terminal stuff

(use-package term
  :commands term
  :config
  (setq explicit-shell-file-name "fish"))

(use-package eterm-256color
  :hook (term-mode . eterm-256color-mode))

(use-package vterm
  :commands vterm
  :config
  (setq vterm-shell "fish")
  (setq vterm-max-scrollback 10000))

(defun efs/configure-eshell ()
  (add-hook 'eshell-pre-command-hook 'eshell-save-some-history)
  (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)
  (evil-define-key '(normal insert visual) eshell-mode-map (kbd "C-r") 'counsel-esh-history)
  (evil-define-key '(normal insert visual) eshell-mode-map (kbd "<home>") 'eshell-bol)
  (evil-normalize-keymaps)
  (setq eshell-history-size 10000
        eshell-buffer-maximum-lines 10000
        eshell-hist-ignoredups t
        eshell-scroll-to-bottom-on-input t))

(use-package eshell-git-prompt
  :after eshell)

(use-package eshell
  :hook (eshell-first-time-mode . efs/configure-eshell)
  :config
  (with-eval-after-load 'esh-opt
    (setq eshell-destroy-buffer-when-process-dies t)
    (setq eshell-visual-commands '("htop" "zsh" "vim")))
(eshell-git-prompt-use-theme 'powerline))

org mode stuff

 (defun efs/org-mode-setup ()
   (org-indent-mode)
   (variable-pitch-mode 1)
   (auto-fill-mode 0)
   (visual-line-mode 1)
   (setq evil-auto-indent nil))

 (defun efs/org-font-setup ()
   (font-lock-add-keywords 'org-mode
                           '(("^ *\\([-]\\) "
                              (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
   (dolist (face '((org-level-1 . 1.2)
                   (org-level-2 . 1.1)
                   (org-level-3 . 1.05)
                   (org-level-4 . 1.0)
                   (org-level-5 . 1.1)
                   (org-level-6 . 1.1)
                   (org-level-7 . 1.1)
                   (org-level-8 . 1.1)))
     (set-face-attribute (car face) nil :font "Cantarell" :weight 'regular :height (cdr face)))
   (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
   (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
   (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
   (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
   (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
   (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))

(use-package org
  :hook (org-mode . efs/org-mode-setup)
  :config
  (setq org-ellipsis "▼")
  (setq org-directory "~/Documents/orgfiles")
  (setq org-agenda-files
        '("tasks.org"
          "birthdays.org"
          "~/org_mode_exp/example-file.org"
          "~/Documents/wizr/work_master.org"))
  (setq org-agenda-start-with-log-mode t)
  (setq org-log-done 'time)
  (setq org-log-into-drawer t)
  (setq org-startup-with-inline-images t)
  (efs/org-font-setup))

 (use-package org-bullets
   :after org
   :hook (org-mode . org-bullets-mode)
   :custom
   (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))

 (defun efs/org-mode-visual-fill ()
   (setq visual-fill-column-width 100
         visual-fill-column-center-text t)
   (visual-fill-column-mode 1))

 (use-package visual-fill-column
   :hook (org-mode . efs/org-mode-visual-fill))
 (setq-default org-pretty-entities t)
 (setq-default org-use-sub-superscripts "{}")
 (setq-default org-startup-with-inline-images t)
 (setq-default org-image-actual-width '(300))
 (setq-default org-hide-emphasis-markers t)
 (global-set-key (kbd "C-c l") #'org-store-link)
 (global-set-key (kbd "C-c a") #'org-agenda)
 (global-set-key (kbd "C-c c") #'org-capture)
 (font-lock-add-keywords 'org-mode
                         '(("^ *\\([-]\\) "
                            (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "●"))))))

org babel

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (python . t)
   (eshell . t)
   (gnuplot . t)
   (sed . t)
   (awk . t)
   (clojure . t)
   (css . t)
   (java . t)
   (latex . t)
   (lua . t)
   (lisp . t)
   (makefile . t)
   (js . t)
   (org . t)
   (perl . t)
   (sql . t)))

(setq org-confirm-babel-evaluate nil)

org mode tagging stuff

workflow states

(setq org-todo-keywords
    '((sequence "TODO(t)" "IN PROGRESS(p)" "WAITING(w)" "|" "DONE(d!)")
      (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)")))
(setq org-refile-targets
      '(("archive.org" :maxlevel . 1)
     ("tasks.org" :maxlevel . 1)))
(advice-add 'org-refile :after 'org-save-all-org-buffers)

tags

(setq org-tag-alist
      '((:startgroup)
     ; put mutually exclusive tags here
     (:endgroup)
     ("errand" . ?E)
     ("home" . ?H)
     ("work" . ?W)
     ("agenda" . ?a)
     ("planning" . ?p)
     ("publish" . ?P)
     ("batch" . ?b)
     ("note" . ?n)
     ("idea" . ?i)
     ("thinking" . ?t)
     ("recurring" . ?r)))

org mode agenda views

(setq org-agenda-custom-commands
      '(("d" "dashboard"
         ((agenda "" ((org-deadline-warning-days 7)))
          (todo "NEXT"
                ((org-agenda-overriding-header "next tasks")))
          (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "active projects")))))
        ("n" "next tasks"
         ((todo "NEXT"
                ((org-agenda-overriding-header "next tasks")))))
        ("W" "work tasks" tags-todo "+work")
        ("e" tags-todo "+TODO=\"NEXT\"+effort<15&+effort>0"
         ((org-agenda-overriding-header "low effort tasks")
          (org-agenda-max-todos 20)
          (org-agenda-files org-agenda-files)))
        ("w" "workflow status"
         ((todo "WAIT"
                ((org-agenda-files org-agenda-files)))
          (todo "REVIEW"
                ((org-agenda-overriding-header "in review")
                 (org-agenda-files org-agenda-files)))
          (todo "PLAN"
                ((org-agenda-overriding-header "in planning")
                 (org-agenda-todo-list-sublevels nil)
                 (org-agenda-files org-agenda-files)))
          (todo "BACKLOG"
                ((org-agenda-overriding-header "project backlog")
                 (org-agenda-todo-list-sublevels nil)
                 (org-agenda-files org-agenda-files)))
          (todo "READY"
                ((org-agenda-overriding-header "ready for work")
                 (org-agenda-files org-agenda-files)))
          (todo "ACTIVE"
                ((org-agenda-overriding-header "active projects")
                 (org-agenda-files org-agenda-files)))
          (todo "COMPLETED"
                ((org-agenda-overriding-header "completed projects")
                 (org-agenda-files org-agenda-files)))
          (todo "CANC"
                ((org-agenda-overriding-header "cancelled projects")
                 (org-agenda-files org-agenda-files)))))))

other org mode stuff

(use-package org-appear
  :hook
  (org-mode . org-appear-mode))

(use-package org-modern
  :hook
  (org-mode . global-org-modern-mode)
  :custom
  (org-modern-keyword nil)
  (org-modern-checkbox nil)
  (org-modern-table nil))

(use-package olivetti
  :demand t
  :bind
  (("<f9>" . ews-distraction-free)))

(defun ews-distraction-free ()
  (interactive)
  (if (equal olivetti-mode nil)
      (progn
        (window-configuration-to-register 1)
        (delete-other-windows)
        (text-scale-set 2)
        (olivetti-mode t))
    (progn
      (if (eq (length (window-list)) 1)
          (jump-to-register 1))
      (olivetti-mode 0)
      (text-scale-set 0))))

(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))

org roam

(use-package emacsql)
(use-package org-roam
  :ensure t
  :init
  (setq org-roam-v2-ack t)
  :custom
  (org-roam-directory "~/Documents/roamnotes")
  (org-roam-completion-everywhere t)
  (org-roam-capture-templates
   '(("d" "default" plain
      "%?"
      :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U\n")
      :unnarrowed t)
     ("m" "Team Meeting" plain
      "\n* Minutes\n\n%?"
      :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U\n#+filetags:work")
      :unnarrowed t)))
  (org-roam-dailies-capture-templates
  '(("d" "default" entry "* %<%I:%M %p>: %?"
     :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))
    ("j" "journal" entry "* %<%I:%M %p>: %?"
     :if-new (file+head "journal/%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d> journal \n"))
    ("m" "meeting" entry "* %<%I:%M %p>: %?"
     :if-new (file+head "meetings/%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d> meeting \n"))))
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert)
         :map org-mode-map
         ("C-M-i" . completion-at-point)
         :map org-roam-dailies-map
         ("Y" . org-roam-dailies-capture-yesterday)
         ("T" . org-roam-dailies-capture-tomorrow))
  :bind-keymap
  ("C-c n d" . org-roam-dailies-map)
  :config
  (require 'org-roam-dailies)
  (org-roam-setup)
  (setq org-roam-dailies-directory "daily/")
  (org-roam-db-autosync-mode))

treemacs emacs openwith modern emacs UI

vertico selectrum marginalia

org-edna

for task dependencies

(org-edna-mode)

other function(s)

(defun efs/read-file-as-string (path)
  (with-temp-buffer
    (insert-file-contents path)
    (buffer-string)))

(push '("conf-unix" . conf-unix) org-src-lang-modes)


vertico


  (defun dw/minibuffer-backward-kill (arg)
  "When minibuffer is completing a file name delete up to parent
folder, otherwise delete a character backward"
  (interactive "p")
  (if minibuffer-completing-file-name
      ;; Borrowed from https://github.com/raxod502/selectrum/issues/498#issuecomment-803283608
      (if (string-match-p "/." (minibuffer-contents))
          (zap-up-to-char (- arg) ?/)
        (delete-minibuffer-contents))
      (delete-backward-char arg)))
               ;; Enable vertico
            (use-package vertico
              :bind (:map minibuffer-local-map
                          ("<backspace>" . dw/minibuffer-backward-kill))
          :custom
          ;; (vertico-scroll-margin 0) ;; Different scroll margin
          ;; (vertico-count 20) ;; Show more candidates
          ;; (vertico-resize t) ;; Grow and shrink the Vertico minibuffer
          ;; (vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
          (keymap-set vertico-map "?" #'minibuffer-completion-help)
          (keymap-set vertico-map "M-TAB" #'minibuffer-complete)

          :init
          (vertico-mode))

        ;; Persist history over Emacs restarts. Vertico sorts by history position.
        (use-package savehist
          :init
          (savehist-mode))

        ;; A few more useful configurations...
        (use-package emacs
          :custom
          ;; Support opening new minibuffers from inside existing minibuffers.
          (enable-recursive-minibuffers t)
          ;; Hide commands in M-x which do not work in the current mode.  Vertico
          ;; commands are hidden in normal buffers. This setting is useful beyond
          ;; Vertico.
          (read-extended-command-predicate #'command-completion-default-include-p)
          :init
          ;; Add prompt indicator to `completing-read-multiple'.
          ;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
          (defun crm-indicator (args)
            (cons (format "[CRM%s] %s"
                          (replace-regexp-in-string
                           "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
                           crm-separator)
                          (car args))
                  (cdr args)))
          (advice-add #'completing-read-multiple :filter-args #'crm-indicator)

          ;; Do not allow the cursor in the minibuffer prompt
          (setq minibuffer-prompt-properties
                '(read-only t cursor-intangible t face minibuffer-prompt))
          (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))

        (use-package orderless
        :custom
        ;; Configure a custom style dispatcher (see the Consult wiki)
        ;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch))
        ;; (orderless-component-separator #'orderless-escapable-split-on-space)
        (completion-styles '(orderless basic))
        (completion-category-defaults nil)
        (completion-category-overrides '((file (styles partial-completion)))))

        (setq completion-styles '(basic substring partial-completion flex))
        (setq read-file-name-completion-ignore-case t
            read-buffer-completion-ignore-case t
            completion-ignore-case t)
        (setq completion-in-region-function
            (lambda (&rest args)
              (apply (if vertico-mode
                         #'consult-completion-in-region)
                     args)))

        (use-package vertico-directory
        :after vertico
        :ensure nil
        ;; More convenient directory navigation commands
        :bind (:map vertico-map
                    ("RET" . vertico-directory-enter)
                    ("DEL" . vertico-directory-delete-char)
                    ("M-DEL" . vertico-directory-delete-word))
        ;; Tidy shadowed file names
        :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))

        (vertico-multiform-mode)

      ;; Configure the display per command.
      ;; Use a buffer with indices for imenu
      ;; and a flat (Ido-like) menu for M-x.
      (setq vertico-multiform-commands
            '((consult-imenu buffer indexed)
              (execute-extended-command unobtrusive)))

      ;; Configure the display per completion category.
      ;; Use the grid display for files and a buffer
      ;; for the consult-grep commands.
      (setq vertico-multiform-categories
            '((file grid)
              (consult-grep buffer)))

      (setq vertico-multiform-commands
          `((consult-outline buffer ,(lambda (_) (text-scale-set -1)))))

      ;; Change the default sorting function.
    ;; See `vertico-sort-function' and `vertico-sort-override-function'.
    (setq vertico-multiform-commands
          '((describe-symbol (vertico-sort-function . vertico-sort-alpha))))

    (setq vertico-multiform-categories
          '((symbol (vertico-sort-function . vertico-sort-alpha))
            (file (vertico-sort-function . sort-directories-first))))

    ;; Sort directories before files
    (defun sort-directories-first (files)
      (setq files (vertico-sort-history-length-alpha files))
      (nconc (seq-filter (lambda (x) (string-suffix-p "/" x)) files)
             (seq-remove (lambda (x) (string-suffix-p "/" x)) files)))

    ;; Configure the buffer display and the buffer display action
  (setq vertico-multiform-categories
        '((consult-grep
           buffer
           (vertico-buffer-display-action . (display-buffer-same-window)))))

  ;; Disable preview for consult-grep commands

  (setq vertico-multiform-categories
      '((buffer flat (vertico-cycle . t))))

consult

  (use-package consult
  ;; Replace bindings. Lazily loaded by `use-package'.
  :bind (;; C-c bindings in `mode-specific-map'
         ("C-c M-x" . consult-mode-command)
         ("C-c h" . consult-history)
         ("C-c k" . consult-kmacro)
         ("C-c m" . consult-man)
         ("C-c i" . consult-info)
         ([remap Info-search] . consult-info)
         ;; C-x bindings in `ctl-x-map'
         ("C-x M-:" . consult-complex-command)     ;; orig. repeat-complex-command
         ("C-x b" . consult-buffer)                ;; orig. switch-to-buffer
         ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
         ("C-x 5 b" . consult-buffer-other-frame)  ;; orig. switch-to-buffer-other-frame
         ("C-x t b" . consult-buffer-other-tab)    ;; orig. switch-to-buffer-other-tab
         ("C-x r b" . consult-bookmark)            ;; orig. bookmark-jump
         ("C-x p b" . consult-project-buffer)      ;; orig. project-switch-to-buffer
         ;; Custom M-# bindings for fast register access
         ("M-#" . consult-register-load)
         ("M-'" . consult-register-store)          ;; orig. abbrev-prefix-mark (unrelated)
         ("C-M-#" . consult-register)
         ;; Other custom bindings
         ("M-y" . consult-yank-pop)                ;; orig. yank-pop
         ;; M-g bindings in `goto-map'
         ("M-g e" . consult-compile-error)
         ("M-g f" . consult-flymake)               ;; Alternative: consult-flycheck
         ("M-g g" . consult-goto-line)             ;; orig. goto-line
         ("M-g M-g" . consult-goto-line)           ;; orig. goto-line
         ("M-g o" . consult-outline)               ;; Alternative: consult-org-heading
         ("M-g m" . consult-mark)
         ("M-g k" . consult-global-mark)
         ("M-g i" . consult-imenu)
         ("M-g I" . consult-imenu-multi)
         ;; M-s bindings in `search-map'
         ("M-s d" . consult-find)                  ;; Alternative: consult-fd
         ("M-s c" . consult-locate)
         ("M-s g" . consult-grep)
         ("M-s G" . consult-git-grep)
         ("M-s r" . consult-ripgrep)
         ("C-s" . consult-line)
         ("M-s L" . consult-line-multi)
         ("M-s k" . consult-keep-lines)
         ("M-s u" . consult-focus-lines)
         ;; Isearch integration
         ("M-s e" . consult-isearch-history)
         :map isearch-mode-map
         ("M-e" . consult-isearch-history)         ;; orig. isearch-edit-string
         ("M-s e" . consult-isearch-history)       ;; orig. isearch-edit-string
         ("M-s l" . consult-line)                  ;; needed by consult-line to detect isearch
         ("M-s L" . consult-line-multi)            ;; needed by consult-line to detect isearch
         ;; Minibuffer history
         :map minibuffer-local-map
         ("M-s" . consult-history)                 ;; orig. next-matching-history-element
         ("M-r" . consult-history))                ;; orig. previous-matching-history-element

  ;; Enable automatic preview at point in the *Completions* buffer. This is
  ;; relevant when you use the default completion UI.
  :hook (completion-list-mode . consult-preview-at-point-mode)

  ;; The :init configuration is always executed (Not lazy)
  :init

  ;; Optionally configure the register formatting. This improves the register
  ;; preview for `consult-register', `consult-register-load',
  ;; `consult-register-store' and the Emacs built-ins.
  (setq register-preview-delay 0.5
        register-preview-function #'consult-register-format)

  ;; Optionally tweak the register preview window.
  ;; This adds thin lines, sorting and hides the mode line of the window.
  (advice-add #'register-preview :override #'consult-register-window)

  ;; Use Consult to select xref locations with preview
  (setq xref-show-xrefs-function #'consult-xref
        xref-show-definitions-function #'consult-xref)

  ;; Configure other variables and modes in the :config section,
  ;; after lazily loading the package.
  :config

  ;; Optionally configure preview. The default value
  ;; is 'any, such that any key triggers the preview.
  ;; (setq consult-preview-key 'any)
  ;; (setq consult-preview-key "M-.")
  ;; (setq consult-preview-key '("S-<down>" "S-<up>"))
  ;; 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-buffer
   consult-bookmark consult-recent-file consult-xref
   consult--source-bookmark consult--source-file-register
   consult--source-recent-file consult--source-project-recent-file :preview-key 'any)
   ;; :preview-key "M-.":preview-key 'any)


  ;; Optionally configure the narrowing key.
  ;; Both < and C-+ work reasonably well.
  (setq consult-narrow-key "<") ;; "C-+"

  ;; Optionally make narrowing help available in the minibuffer.
  ;; You may want to use `embark-prefix-help-command' or which-key instead.
  ;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
)

nix mode

(use-package nix-mode
  :mode "\\.nix\\'")

treemacs

 (use-package treemacs
   :ensure t
   :defer t
;   :init
;   (with-eval-after-load 'winum
;     (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
   :config
   (progn
     (setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
           treemacs-deferred-git-apply-delay 0.5
           treemacs-directory-name-transformer      #'identity
           treemacs-display-in-side-window          t
           treemacs-eldoc-display                   'simple
           treemacs-file-event-delay                2000
           treemacs-file-extension-regex            treemacs-last-period-regex-value
           treemacs-file-follow-delay               0.2
           treemacs-file-name-transformer           #'identity
           treemacs-follow-after-init               t
           treemacs-expand-after-init               t
           treemacs-find-workspace-method           'find-for-file-or-pick-first
           treemacs-git-command-pipe                ""
           treemacs-goto-tag-strategy               'refetch-index
           treemacs-header-scroll-indicators        '(nil . "^^^^^^")
           treemacs-hide-dot-git-directory          t
           treemacs-indentation                     2
           treemacs-indentation-string              " "
           treemacs-is-never-other-window           nil
           treemacs-max-git-entries                 5000
           treemacs-missing-project-action          'ask
           treemacs-move-files-by-mouse-dragging    t
           treemacs-move-forward-on-expand          nil
           treemacs-no-png-images                   nil
           treemacs-no-delete-other-windows         t
           treemacs-project-follow-cleanup          nil
           treemacs-persist-file                    (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
           treemacs-position                        'left
           treemacs-read-string-input               'from-child-frame
           treemacs-recenter-distance               0.1
           treemacs-recenter-after-file-follow      nil
           treemacs-recenter-after-tag-follow       nil
           treemacs-recenter-after-project-jump     'always
           treemacs-recenter-after-project-expand   'on-distance
           treemacs-litter-directories              '("/node_modules" "/.venv" "/.cask")
           treemacs-project-follow-into-home        nil
           treemacs-show-cursor                     nil
           treemacs-show-hidden-files               t
           treemacs-silent-filewatch                nil
           treemacs-silent-refresh                  nil
           treemacs-sorting                         'alphabetic-asc
           treemacs-select-when-already-in-treemacs 'move-back
           treemacs-space-between-root-nodes        t
           treemacs-tag-follow-cleanup              t
           treemacs-tag-follow-delay                1.5
           treemacs-text-scale                      nil
           treemacs-user-mode-line-format           nil
           treemacs-user-header-line-format         nil
           treemacs-wide-toggle-width               70
           treemacs-width                           35
           treemacs-width-increment                 1
           treemacs-width-is-initially-locked       t
           treemacs-workspace-switch-cleanup        nil)

     ;; The default width and height of the icons is 22 pixels. If you are
     ;; using a Hi-DPI display, uncomment this to double the icon size.
     ;;(treemacs-resize-icons 44)

     (treemacs-follow-mode t)
     (treemacs-filewatch-mode t)
     (treemacs-fringe-indicator-mode 'always)
     (when treemacs-python-executable
       (treemacs-git-commit-diff-mode t))

     (pcase (cons (not (null (executable-find "git")))
                  (not (null treemacs-python-executable)))
       (`(t . t)
        (treemacs-git-mode 'deferred))
       (`(t . _)
        (treemacs-git-mode 'simple)))

     (treemacs-hide-gitignored-files-mode nil))
   :bind
   (:map global-map
         ("M-0"       . treemacs-select-window)
         ("C-x t 1"   . treemacs-delete-other-windows)
         ("C-x t t"   . treemacs)
         ("C-x t d"   . treemacs-select-directory)
         ("C-x t B"   . treemacs-bookmark)
         ("C-x t C-t" . treemacs-find-file)
         ("C-x t M-t" . treemacs-find-tag)))

 (use-package treemacs-evil
   :after (treemacs evil)
   :ensure t)

 (use-package treemacs-projectile
   :after (treemacs projectile)
   :ensure t)

 (use-package treemacs-icons-dired
   :hook (dired-mode . treemacs-icons-dired-enable-once)
   :ensure t)

 (use-package treemacs-magit
   :after (treemacs magit)
   :ensure t)

 (use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
   :after (treemacs persp-mode) ;;or perspective vs. persp-mode
   :ensure t
   :config (treemacs-set-scope-type 'Perspectives))

 (use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
   :after (treemacs)
   :ensure t
   :config (treemacs-set-scope-type 'Tabs))

 (treemacs-start-on-boot)

javascript stuff

(setq js-indent-level 2)

start page

;    (setq initial-buffer-choice "~/.emacs.d/start.org")
;    (define-minor-mode start-mode
;      "provide functions for custom start page"
;      :lighter " start"
;      :keymap (let ((map (make-sparse-keymap)))
;                ;;(define-key map (kbd "M-z") 'eshell)
;                (evil-define-key 'normal start-mode-map
;                  (kbd "C-u 1") '(lambda () (interactive) (find-file "~/.dotfiles/config.org"))
;                  (kbd "C-u 2") '(lambda () (interactive) (find-file "~/.dotfiles/config.el")))
;                map))
;  (add-hook 'start-mode-hook 'org-mode)
;  (add-hook 'start-mode-hook 'read-only-mode)
;  (add-hook 'start-mode-hook (lambda () (org-display-inline-images t)))
  ;  (provide 'start-mode)
  ;    (add-hook mode (lambda () (display-line-numbers-mode 0))))

dashboard

(use-package dashboard
  :ensure t
  :config
  (setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
  (dashboard-setup-startup-hook)
  (setq dashboard-banner-logo-title "welcome to emacs")
  (setq dashboard-startup-banner 'logo)
  (setq dashboard-center-content t)
  (setq dashboard-vertically-center-content t)
  (setq dashboard-items '((recents . 3)
                          (bookmarks . 5)
                          (agenda . 3)))
  (setq dashboard-agenda-sort-strategy '(time-up habit-down priority-down cateogry-keep))
  (setq dashboard-agenda-time-string-format "%d-%m %a"))


miscellaneous settings

(global-display-line-numbers-mode)
(setq ring-bell-function 'ignore)
(add-to-list 'safe-local-variable-values '(org-roam-directory . "~/Documents/wizr/meetingnotes"))
(add-to-list 'safe-local-variable-values '(org-roam-db-location . "~/Documents/wizr/meetingnotes/org-roam.db"))

Emacs 29.4 (Org mode 9.6.15)