Skip to content

mpetco/emacs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my emacs config

This is a literate emacs config meaning I write my config in this org file and use org babel tangle in my init.el to turn the code blocks in this org file into a .el file. Feel free to copy any part of this config (if copied my fair share although I try to include where I got it from like a guide you should check those guides out they might come in useful).

TABLE OF CONTENTS

EXPLANATION

At first I tried using tags to mark certain headings for certain functions like separate headings configuring something org related. That didn’t work as well as I had hoped so i opted for this way of doing headlines for my config. Where I configure a “function” (feature would be better word) of emacs in a single heading

IMPORTANT LOAD FIRST

Configurations to be loaded before everything else

ELPACA

From time to time you have to manually grab the latest one from https://github.com/progfolio/elpaca. Or just increment elpaca-installer-version although sometimes changes are made to the config itself.

(defvar elpaca-installer-version 0.11)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
                              :ref nil :depth 1 :inherit ignore
                              :files (:defaults "elpaca-test.el" (:exclude "extensions"))
                              :build (:not elpaca--activate-package)))
(let* ((repo  (expand-file-name "elpaca/" elpaca-repos-directory))
       (build (expand-file-name "elpaca/" elpaca-builds-directory))
       (order (cdr elpaca-order))
       (default-directory repo))
  (add-to-list 'load-path (if (file-exists-p build) build repo))
  (unless (file-exists-p repo)
    (make-directory repo t)
    (when (< emacs-major-version 28) (require 'subr-x))
    (condition-case-unless-debug err
        (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
                  ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
                                                  ,@(when-let* ((depth (plist-get order :depth)))
                                                      (list (format "--depth=%d" depth) "--no-single-branch"))
                                                  ,(plist-get order :repo) ,repo))))
                  ((zerop (call-process "git" nil buffer t "checkout"
                                        (or (plist-get order :ref) "--"))))
                  (emacs (concat invocation-directory invocation-name))
                  ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
                                        "--eval" "(byte-recompile-directory \".\" 0 'force)")))
                  ((require 'elpaca))
                  ((elpaca-generate-autoloads "elpaca" repo)))
            (progn (message "%s" (buffer-string)) (kill-buffer buffer))
          (error "%s" (with-current-buffer buffer (buffer-string))))
      ((error) (warn "%s" err) (delete-directory repo 'recursive))))
  (unless (require 'elpaca-autoloads nil t)
    (require 'elpaca)
    (elpaca-generate-autoloads "elpaca" repo)
    (load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

;; install use-package support
(elpaca elpaca-use-package
  ;; Enable use-package :ensure support for Elpaca.
  (elpaca-use-package-mode)) 

;; Assume :elpaca t unless otherwise specified
(setq use-package-always-ensure t)

;;When installing a package used in the init file itself,
;;e.g. a package which adds a use-package key word,
;;use the :wait recipe keyword to block until that package is installed/configured.
;;For example:
;; (use-package general :ensure (:wait t) :demand t)

;;Turns off elpaca-use-package-mode current declaration
;;Note this will cause evaluate the declaration immediately. It is not deferred.
;;Useful for configuring built-in emacs features.

BUFFER-MOVE

I think I took this from distrotube.

(require 'windmove)

;;;###autoload
(defun buf-move-up ()
  "Swap the current buffer and the buffer above the split.
If there is no split, ie now window above the current one, an
error is signaled."
  ;;  "Switches between the current buffer, and the buffer above the
  ;;  split, if possible."
  (interactive)
  (let* ((other-win (windmove-find-other-window 'up))
         (buf-this-buf (window-buffer (selected-window))))
    (if (null other-win)
        (error "No window above this one")
      ;; swap top with this one
      (set-window-buffer (selected-window) (window-buffer other-win))
      ;; move this one to top
      (set-window-buffer other-win buf-this-buf)
      (select-window other-win))))

;;;###autoload
(defun buf-move-down ()
  "Swap the current buffer and the buffer under the split.
If there is no split, ie now window under the current one, an
error is signaled."
  (interactive)
  (let* ((other-win (windmove-find-other-window 'down))
         (buf-this-buf (window-buffer (selected-window))))
    (if (or (null other-win)
            (string-match
             "^ \\*Minibuf" (buffer-name (window-buffer other-win))))
        (error "No window under this one")
      ;; swap top with this one
      (set-window-buffer (selected-window) (window-buffer other-win))
      ;; move this one to top
      (set-window-buffer other-win buf-this-buf)
      (select-window other-win))))

;;;###autoload
(defun buf-move-left ()
  "Swap the current buffer and the buffer on the left of the split.
If there is no split, ie now window on the left of the current
one, an error is signaled."
  (interactive)
  (let* ((other-win (windmove-find-other-window 'left))
         (buf-this-buf (window-buffer (selected-window))))
    (if (null other-win)
        (error "No left split")
      ;; swap top with this one
      (set-window-buffer (selected-window) (window-buffer other-win))
      ;; move this one to top
      (set-window-buffer other-win buf-this-buf)
      (select-window other-win))))

;;;###autoload
(defun buf-move-right ()
  "Swap the current buffer and the buffer on the right of the split.
If there is no split, ie now window on the right of the current
one, an error is signaled."
  (interactive)
  (let* ((other-win (windmove-find-other-window 'right))
         (buf-this-buf (window-buffer (selected-window))))
    (if (null other-win)
        (error "No right split")
      ;; swap top with this one
      (set-window-buffer (selected-window) (window-buffer other-win))
      ;; move this one to top
      (set-window-buffer other-win buf-this-buf)
      (select-window other-win))))

PERMANENT CONFIG

EMACS TWEAKS

STARTUP TWEAKS

GRAPHICAL USER INTERFACE TWEAKS

Disable Menubar, Toolbars and Scrollbars

(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

Display Line Numbers and Truncated Lines

(global-display-line-numbers-mode t)
(setq display-line-numbers-type 'relative)
(global-visual-line-mode t)

Enable short answers

(setopt use-short-answers t)

FONTS

setting the font face

(set-face-attribute 'default nil ;; default font
                    :font "Monaspace Argon"
                    :height 110
                    :weight 'medium)
(set-face-attribute 'variable-pitch nil ;; non-monospace (u use monaspace soo...)
		    :font "Monaspace Argon"
		    :height 120
		    :weight 'regular)
(set-face-attribute 'fixed-pitch nil ;; monospace
                    :font "Monaspace Argon"
                    :height 110
                    :weight 'medium)
;; Makes commented text and keywords italics.
;; This is working in emacsclient but not emacs.
;; Your font must have an italic face available.
;; (set-face-attribute 'font-lock-comment-face nil :slant 'italic)
;; (set-face-attribute 'font-lock-keyword-face nil :slant 'italic)

;; This sets the default font on all graphical frames created after restarting Emacs.
;; Does the same thing as 'set-face-attribute default' above, but emacsclient fonts
;; are not right unless I also add this method of setting the default font.
(add-to-list 'default-frame-alist '(font . "Monaspace Argon-11"))

;; Uncomment the following line if line spacing needs adjusting.
;; (setq-default line-spacing 0.12)

zooming in/out

(global-set-key (kbd "C-=") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)

GIF

(setq image-animate-loop t)

backups

backups go in there

;;(use-package nyan-mode)
(setq backup-directory-alist '((".*" . "~/.cache/emacs/")))

global auto revert

A buffer can get out of sync with respect to its visited file on disk if that file is changed by another program. To keep it up to date, you can enable Auto Revert mode by typing M-x auto-revert-mode, or you can set it to be turned on globally with ‘global-auto-revert-mode’. I have also turned on Global Auto Revert on non-file buffers, which is especially useful for ‘dired’ buffers.

;; (use-package autorevert
;;   :ensure nil
;;   :hook (after-init . global-auto-revert-mode)
;;   :config
;;   (setq auto-revert-verbose t))
(global-auto-revert-mode 1)
(setq global-auto-revert-non-file-buffers t)

WEBP SUPPORT

Depends on either ffmpeg or imagemagick.

(setq image-use-external-converter t)

BEEPING BELL

(use-package emacs
  :ensure nil
  :config (setq ring-bell-function #'ignore) ;; what does this do? why is it here? i guess it gets rid of the ding
  (setq visible-bell t))

CONFIGURATIONS

Here I put a certain kind of configuration. A configuration that fullfills a purpose and which it does not make sense to split up a whole.

ZETTELKASTEN

BIBTEX

Why don’t I use a bibliography program like a normal person? https://tex.stackexchange.com/questions/454966/biblatex-custom-entries-with-emacs-bibtex-mode

(use-package bibtex
  :ensure nil
  :config
  (setq bibtex-dialect 'biblatex)
  ;; (add-to-list 'bibtex-biblatex-entry-alist 
  ;; 	       '(("Video" "A youtube video"
  ;; 		  (("youtuber")
  ;; 		   ("title" "Title of the video"))
  ;; 		  (("year"))
  ;; 		  (("playlist" "playlist in which the video is a part of")
  ;; 		   ("position in playlist")
  ;; 		   ("note")))
  ;; 		 )
  ;; 	       )

;; Support for custom biblatex entries and fields in BibTeX mode
  (setq bibtex-biblatex-field-alist
        (append bibtex-biblatex-field-alist
                '(("shortarchive"))))

  (setq bibtex-biblatex-entry-alist
        (append bibtex-biblatex-entry-alist
                '(("Archive" "Archive"
                   (("title"))
                   nil
                   (("location") ("shortarchive"))))))

  ;; Taken from bibtex.el, the routine that builds the menus etc.
  ;; This must be (re)executed after `bibtex-biblatex-entry-alist` and
  ;; `bibtex-biblatex-field-alist` have been redefined. Alternative is to
  ;; redefine the *full* lists with `setq` in the `:init` section
  (let ((select-map (make-sparse-keymap)))
  ;; Submenu for selecting the dialect
  (dolist (dialect (reverse bibtex-dialect-list))
    (define-key select-map (vector dialect)
      `(menu-item ,(symbol-name dialect)
                  (lambda () (interactive) (bibtex-set-dialect ',dialect t))
                  :button (:radio . (eq bibtex-dialect ',dialect)))))
  ;; We define a menu for each dialect.
  ;; Then we select the menu we want via the :visible keyword
  (dolist (dialect bibtex-dialect-list)
    (let ((entry-alist (bibtex-entry-alist dialect))
          (menu-map (make-sparse-keymap)))
      (define-key menu-map [select]
        `(menu-item "BibTeX dialect" ,select-map))
      (define-key menu-map [nil-2] '(menu-item "--"))
      (define-key menu-map [bibtex-preamble]
        '(menu-item "Preamble" bibtex-Preamble))
      (define-key menu-map [bibtex-String]
        '(menu-item "String" bibtex-String))
      (define-key menu-map [nil-1] '(menu-item "--"))
      (dolist (elt (reverse entry-alist))
        ;; Entry commands
        (let* ((entry (car elt))
               (fname (intern (format "bibtex-%s" entry))))
          (unless (fboundp fname)
            (eval (list 'defun fname nil
                        (format "Insert a template for a @%s entry; see also `bibtex-entry'."
                                entry)
                        '(interactive "*")
                        `(bibtex-entry ,entry))))
          ;; Menu entries
          (define-key menu-map (vector fname)
            `(menu-item ,(or (nth 1 elt) (car elt)) ,fname))))
      (define-key bibtex-mode-map
        (vector 'menu-bar dialect)
        `(menu-item "Entry-Types" ,menu-map
                    :visible (eq bibtex-dialect ',dialect))))))
  ;; End of taken from bibtex.el
  )

EBIB

(use-package ebib 
:config 
(setq ebib-bibtex-dialect 'biblatex)
(setq ebib-reading-list-file "~/Notes/roam/consumptionlist.org")
;;(setq ebib-default-entry-type "Video")
)

ORG-ROAM

Roam research clone for emacs. Here I use it to setup a zettelkasteny note taking and personal knowledge managment system.

(use-package
 org-roam
 :ensure t
 :after org
 :custom
 (org-roam-directory (file-truename "~/Notes/roam/")) ;;rename it to main or dont use it at all
 (org-roam-dailies-directory "daily")
 (org-roam-completion-everywhere t)

 ;; configures templates for nodes
 (org-roam-capture-templates
  '(
    ;; ("d" "default" plain "%?"
    ;;  :target (file+head "%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n#+type: %^{type}\n#+filetags: :draft:%^{tags}")
    ;;  :unnarrowed t)

    ("f" "fleeting note" plain "%?"
     :target
     (file+head
      "fleeting/%<%Y%m%d%H%M%S>-${slug}.org"
      "#+title: ${title}\n#+type: fleeting\n#+filetags: :draft:%^{tags}")
     :unnarrowed t)

    ("l" "literature note" plain "%?"
     :target
     (file+head
      "%(expand-file-name (or citar-org-roam-subdir \"\") org-roam-directory)/reference/notes/${citar-citekey}.org"
      "#+title: ${citar-citekey} (${citar-date}). ${note-title}.\n#+type: literature\n#+created: %U\n#+last_modified: %U\n\n")
     :unnarrowed t)

    ("r" "reference note" plain "%?"
     :target
     (file+head
      "%(expand-file-name (or citar-org-roam-subdir \"\") org-roam-directory)/reference/notes/${citar-citekey}.org"
      "#+title: ${citar-citekey} (${citar-date}). ${note-title}.\n#+type: reference\n#+created: %U\n#+last_modified: %U\n\n")
     :unnarrowed t)

    ("p" "permanent note" plain "%?"
     :target
     (file+head
      "main/%<%Y%m%d%H%M%S>-${slug}.org"
      "#+title: ${title}\n#+type: permanent\n#+filetags: :draft:%^{tags}")
     :unnarrowed t)

    ("w" "mywork" plain "%?"
     :target
     (file+head
      "myworks/${slug}.org"
      "#+title: ${title}\n#+type: %^{type}#+filetags: :draft:%^{tags}")
     :unnarrowed t)))

 ;; configures the org roam buffer display for backlinks
 (add-to-list
  'display-buffer-alist
  '("\\*org-roam\\*"
    (display-buffer-in-direction)
    (direction . right)
    (window-width . 0.33)
    (window-height . fit-window-to-buffer)))

 ;; configures the org-roam-node-find menu

 (org-roam-node-display-template
  (concat
   "${type:10} ${title:25} "
   (propertize "${tags:150}" 'face 'org-tag)))
 :config

 (cl-defmethod org-roam-node-type ((node org-roam-node))
   "Return the TYPE of NODE."
   (if (org-roam-node-file node)
       (with-temp-buffer
         (insert-file-contents (org-roam-node-file node) nil 0 nil)
         (org-roam--get-keyword "type"))
     (org-roam--get-keyword "type" nil)))

 :config (org-roam-db-autosync-enable))
ORG-ROAM-BIBTEX
(use-package org-roam-bibtex :config (setq bibtex-completion-edit-notes-function 'orb-bibtex-completion-edit-note
(require 'citar-org-roam)
(citar-register-notes-source
 'orb-citar-source (list :name "Org-Roam Notes"
        :category 'org-roam-node
        :items #'citar-org-roam--get-candidates
        :hasitems #'citar-org-roam-has-notes
        :open #'citar-org-roam-open-note
        :create #'orb-citar-edit-note
        :annotate #'citar-org-roam--annotate))
(setq citar-notes-source 'orb-citar-source)
)) ; use org-roam-capture-templates for notes
ORG-ROAM-UI
(use-package org-roam-ui
    :after org
    :config
    (setq org-roam-ui-sync-theme t
          org-roam-ui-follow t
          org-roam-ui-update-on-save t
          org-roam-ui-open-on-start t))

CITAR

(use-package citar 
  :custom 
  (citar-bibliography '("~/Notes/roam/reference/master.bib"))
  (citar-notes-paths '("~/Notes/roam/reference/notes/"))
  (citar-library-paths '("~/Notes/roam/reference/rawsource/"))
  ;;(citar-library-file-extensions '(".pdf" ".mp4")) ;;what files citar opens and handles
  ;;(setq citar-library-paths)
  :hook
  (LaTeX-mode . citar-capf-setup)
  (org-mode . citar-capf-setup)
  )
CITAR-EMBARK
(use-package citar-embark
  :after citar embark
  :no-require
  :config (citar-embark-mode))
CITAR-ORG-ROAM
(use-package citar-org-roam
  :after (citar org-roam)
  :config (citar-org-roam-mode)
(setq citar-org-roam-note-title-template "${author} - ${title}")
(setq citar-org-roam-capture-template-key "l")
)

KEYCHORDS

add docs to all entries determine which can be repeated and organize the the keys by frequency and logic while the defvars by alphabet

;; organize the keymaps and keybindings by frequency
(use-package emacs
  :ensure nil
  :after evil
  :config
  
;; Activities
(defvar-keymap my-activities-map
  :doc "Keymap for activities package"
  "n" #'activities-new
  "d" #'activities-define-forcep ;; it was easier to define a new function
  "r" #'activities-resume
  "s" #'activities-suspend ;; only works with emacs daemon
  "k" #'activities-kill
  "w" #'activities-switch
  "b" #'activities-switch-buffer
  "v" #'activities-revert
  "i" #'activities-discard
  "l" #'activities-list)

;; Buffer
(defvar-keymap my-buffer-map
  :doc "Keymap for working with buffers"
  :repeat t
  ;;"a" #'rename-buffer
  ;;"b" #'switch-to-buffer
  "b" #'consult-buffer
  "i" #'ibuffer
  "k" #'kill-current-buffer
  "d" #'kill-buffer
  ;;"n" (cons "nextbuf" 'next-buffer) repeat mode doesnt work with cons
  "n" #'next-buffer
  "p" #'previous-buffer
  "x" #'scratch-buffer
  "r" #'revert-buffer)

;; (which-key-add-keymap-based-replacements my-buffer-map
;;   "b" `("switch buffer" . switch-to-buffer)
;;   "k" `("kill buffer" . kill-current-buffer)
;;   "r" `("reload buffer" . revert-buffer))
;; "b" `("Buffer" . ,my-buffer-map) - for variables

;; Dired
(defvar-keymap my-dired-map
  :doc "Keymap for activities package"
  "d" (cons "Open dired" #'dired)
  "j" (cons "Dired jump to current" #'dired-jump)
  "o" (cons "Dired open with" #'dired-open-with)
  "p" (cons "Dired preview mode" #'dired-preview-mode)
  "n" (cons "Open directory in neotree" #'neotree-dir))

;; Elisp
(defvar-keymap my-elisp-map ;; check the map if there are any cool things to add
  :doc "Map for elisp related commands"
  "b" #'eval-buffer
  "d" #'eval-defun
  "e" #'eval-expression
  "f" #'indent-pp-sexp
  "h" #'esh-history
  "i" #'indent-region
  "l" #'eval-last-sexp
  "r" #'eval-region
  "s" #'eshell)

;; Bookmarks
(defvar-keymap my-bookmark-map
;; look into boomarks get them working, so you can jump into projects like config without a hassle almost harpoon like
  ;;"f" #'find-file
  ;;"c" (cons "Edit emacs config" (lambda () (interactive) (find-file "~/.config/emacs/config.org")))
  ;;"r" #'recentf
  ;; organize these alphabetically since which key does that
  "d" #'bookmark-delete
  "l" #'edit-bookmarks
  "m" #'bookmark-set-no-overwrite
  ;;"j" #'bookmark-jump
  "j" #'consult-bookmark
  "r" #'bookmark-rename)
  ;; bookmark-write bookmark-save bookmark-load

;; Help map
(defvar-keymap my-help-map ;; look at the help map for inspa
  :repeat t
  "e" #'kill-emacs
  "r" (lambda () (interactive) (load-file "~/.config/emacs/config.el"))
  "a" #'apropos
  "f" #'describe-function
  "v" #'describe-variable
  "c" #'describe-command
  "k" #'describe-key
  "m" #'describe-mode
  "y" #'describe-keymap
  "p" #'describe-package)

(which-key-add-keymap-based-replacements my-help-map
  "r" `("reload config" . lambda)
  "e" `("exit emacs" . kill-emacs))

;; Git
(defvar-keymap my-git-map
  "g" #'magit
  "d" #'magit-diff
  "t" #'git-timemachine)

(add-hook 'prog-mode-hook
          (lambda ()
            (evil-local-set-key 'normal (kbd "SPC g") (cons "Git" my-git-map))
            (evil-local-set-key 'visual (kbd "SPC g") (cons "Git" my-git-map))))


;; Zettelkasten
(defvar-keymap my-citar-map
  "o" #'citar-open ;; i got rid of citar-open-notes and citar open is fine i think
  "n" #'citar-open-notes
  "i" #'citar-insert-citation
  "e" #'embark-act
)

(defvar-keymap my-zettelkasten-map
  "w" (lambda () (interactive) (ebib "~/Notes/roam/reference/master.bib" "a"))
  ;; roam
  "l" #'org-roam-buffer-toggle
  "f" #'org-roam-node-find
  "g" #'org-roam-graph
  "i" #'org-roam-node-insert
  ;;"e" #'org-roam-ref-add
  ;;"n" #'org-roam-ref-find
  ;;"c" #'org-roam-capture
  "j" #'org-roam-dailies-capture-today
  ;;"h" #'org-id-get-create
  "r" #'org-roam-node-random
  "t" #'org-roam-tag-add
  "a" #'org-roam-alias-add
  ;; ebib
  "e" (lambda () (interactive) (ebib "~/Notes/roam/reference/master.bib"))
  ;; citar
  "c" (cons "citar" my-citar-map)
)

;; (which-key-add-keymap-based-replacements my-zettelkasten-map
;;   "e" `("ebib" . lambda))

    ;; "nf" '(org-roam-node-find :wk "Find notes")
    ;; "ng"  '(org-roam-graph :wk "Show a graph of all of yours nodes")
    ;; "ni"  '(org-roam-node-insert :wk "Insert a link to another node")
    ;; "ne"  '(org-roam-ref-add :wk "Insert a reference")
    ;; "nc"  '(org-roam-capture :wk "Capture a note into your personal wiki")
    ;; "nj" '(org-roam-dailies-capture-today :wk "Org roam dailies")
    ;; "nh" '(org-id-get-create :wk "Create a heading note")
    ;; "nr" '(org-roam-node-random :wk "Open a random note")
    ;; "nt" '(org-roam-tag-add :wk "Add a tag to a node")
    ;; "na" '(org-roam-alias-add :wk "Create an alias for a note"))

;; Windows

(defvar-keymap my-window-map
  :repeat t ;; maybe just make specific keybindings repeat?
  ;; Window splits
  "c" #'evil-window-delete
  "o" #'delete-other-windows
  "n" #'evil-window-new
  "-" #'evil-window-split
  "\\" #'evil-window-vsplit
  ;; Window motions
  "h" #'evil-window-left
  "j" #'evil-window-down
  "k" #'evil-window-up
  "l" #'evil-window-right
  "w" #'evil-window-next
  ;; Move Windows
  "H" #'buf-move-left
  "J" #'buf-move-down
  "K" #'buf-move-up
  "L" #'buf-move-right)
  ;; Resize Windows
  ;;"=" #'((enlarge-window) (enlarge-window-horizontally)))
  ;;"0" #'shrink-window #'shrink-window-horizontally)

(which-key-add-keymap-based-replacements my-window-map
  "c" `("Close window" . evil-window-delete)
  "o" `("Close other window" . delete-other-windows)
  "n" `("New window" . evil-window-new)
  "-" `("Horizontal split" . evil-window-split)
  "h" `("Window left" . evil-window-left)
  "j" `("Window down" . evil-window-down)
  "k" `("Window up" . evil-window-up)
  "l" `("Window right" . evil-window-right)
  "w" `("Goto next window" . evil-window-next))

;; Org
(defvar-keymap my-global-org-map
  :repeat t
  "a" #'org-agenda
  "c" #'org-capture
  ;;"f" (lambda () (interactive) (cd "~/Notes/GTD") (call-interactively 'find-file)) :wk "Find GTD files"
  "i" (lambda () (interactive) (org-capture nil "i"))
  "g" (lambda () (interactive) (org-agenda nil "g")))

(which-key-add-keymap-based-replacements my-global-org-map
  "c" `("Capture an idea" . org-capture)
  "i" `("Capture into inbox" . (lambda () (interactive) (org-capture nil "i")))
  "g" `("GTD agenda view" . (lambda () (interactive) (org-agenda nil "g"))))

;; Org tables map
(defvar-keymap my-org-table-map
  ;; add the create table command from table.el and more table options
  ;; org table insert row
  "-" #'org-table-insert-hline)

(which-key-add-keymap-based-replacements my-org-table-map
  "-" `("Insert hline in table" . org-table-insert-hline))

;; Org timestamp map
(defvar-keymap my-org-timestamp-map
  "s" #'org-schedule
  "d" #'org-deadline
  "t" #'org-timestamp
  "i" #'org-timestamp-inactive) ;; look into this one

(which-key-add-keymap-based-replacements my-org-timestamp-map
  "s" `("Org schedule" . org-schedule)
  "d" `("Org deadline" . org-deadline)
  "t" `("Org timestamp" . org-timestamp)
  "i" `("Org inactive timestamp" . org-timestamp-inactive))

(defvar-keymap my-org-clock-map
  "i" #'org-clock-in
  "o" #'org-clock-out)

(defvar-keymap my-org-map
  :repeat t
  "r" #'org-refile ;; C-c C-w
  "t" #'org-todo ;; C-c C-t for the state of the entry
  "T" #'org-ctrl-c-ctrl-c ;; C-c C-c  for tags
  "B" #'org-babel-tangle
  "e" #'org-export-dispatch
  "E" #'org-set-effort
  "I" #'org-toggle-item
  "x" #'org-toggle-checkbox
  "o" #'org-open-at-point
  "l" #'org-insert-link
  "N" #'org-toggle-inline-images
  "P" #'org-download-clipboard 
  ;; Org clock
  "k" (cons "Clock" my-org-clock-map)
  ;; Tables
  "b" (cons "Table" my-org-table-map)
  ;; Org timestamps
  "d" (cons "Date/deadline" my-org-timestamp-map))

(which-key-add-keymap-based-replacements my-org-map
  "T" `("set tags for an entry" . org-ctrl-c-ctrl-c)
  "P" `("paste image" . org-download-clipboard)
  "o" `("open a link" . org-open-at-point))

(add-hook 'org-mode-hook
          (lambda ()
            (evil-local-set-key 'normal (kbd "SPC m") my-org-map)
            (evil-local-set-key 'visual (kbd "SPC m") my-org-map)))

;; Pomodoro
(defvar-keymap my-pomodoro-map
  :doc "Keymap for a pomodoro configured org clock"
  :repeat t ;; yay add describe repeat maps to myhelp
  ;;:parent global-map
   "b" (lambda () (interactive) (org-timer-set-timer "00:25:00"))
   "s" #'org-timer-stop
   "p" #'org-timer-pause-or-continue)

(which-key-add-keymap-based-replacements my-pomodoro-map
  "b" `("begin working" . lambda))

;; Projectile
(defvar-keymap my-project-map ;; look at the keymap add more entries
    "f" #'projectile-find-file
    "r" #'projectile-recentf
    ;;"s" #'project-search :wk "Project search")
    "c" #'projectile-compile-project
    "b" #'consult-project-buffer
    "p" #'projectile-switch-project)

;; Leisure 
(defvar-keymap my-leisure-map
  ;;"g" gaming
  ;;"w" website browsing
  ;;"f" forums
  "y" #'yeetube-search
  ;;"i" irc
  "l" #'embark-org-copy-link-in-full
  "w" #'weather-scout-show-forecast
  "e" #'elfeed)

;; prog mode
;; Flymake 
(defvar-keymap my-flymake-map
  :doc "Flymake map"
  "n" #'flymake-goto-next-error
  "p" #'flymake-goto-prev-error)

(add-hook 'prog-mode-hook
          (lambda ()
            (evil-local-set-key 'normal (kbd "SPC f") my-flymake-map)
            (evil-local-set-key 'visual (kbd "SPC f") my-flymake-map)))

;; Format
(defvar-keymap my-format-map
  :doc "format map"
  "b" #'eglot-format-buffer
  "r" #'eglot-format)

(add-hook 'prog-mode-hook
          (lambda ()
            (evil-local-set-key 'normal (kbd "SPC f") my-format-map)
            (evil-local-set-key 'visual (kbd "SPC f") my-format-map)))

  ;; (leader-prog
  ;;   "f" '(:ignore t :wk "Format")
  ;;   ;; "fe" '(:ignore t :wk "Format Elisp")
  ;;   ;; "feb" '(elisp-autofmt-buffer :wk "Format the entire buffer")
  ;;   ;; "fer" '(elisp-autofmt-region :wk "Format the selected text")
  ;;   "fl"  '(:ignore t :wk "Lsp format")
  ;;   "flr"  '(eglot-format :wk "Format region")
  ;;   "flb"  '(eglot-format-buffer :wk "Format buffer"))

;; Undo
(defvar-keymap my-undo-map
  :doc "Undo map"
  "v" #'vundo)

;; Tex map compile tex format tex

;; ELPACA
;; use l for this one
;; mix and match some of the regular package commands
;; elpaca browse elpaca manager

;; GLOBAL
(defvar-keymap my-global-map
  :doc "My global map"
  "SPC" (cons "M-x" #'execute-extended-command)
  "." (cons "Find file" #'find-file)
  "," (cons "Switch buffer" #'switch-to-buffer)
  "TAB" (cons "Comment line(s)" #'comment-line)
  "a" (cons "Activities" my-activities-map)
  "b" (cons "Buffer" my-buffer-map)
  ;;"d" (cons "Dired" my-dired-map) ;; i dont know if i'll use it
  "h" (cons "Help" my-help-map)
  "z" (cons "Zettelkasten" my-zettelkasten-map)
  "e" (cons "Elisp" my-elisp-map)
  "k" (cons "Bookmark" my-bookmark-map)
  "w" (cons "Windows" my-window-map)
  "m" (cons "Org" my-global-org-map)
  "p" (cons "Projectile" my-project-map)
  "l" (cons "Leisure" my-leisure-map)
  ;;"c" (cons "Elpaca" my-leisure-map)
  ;;"P" (cons "Pomodoro" my-pomodoro-map)
  )

;;(evil-global-set-key 'normal (kbd "SPC") my-global-map) 
(evil-define-key '(normal visual emacs motion) 'global (kbd "SPC") my-global-map)






)

KEYCHORD GLOBAL MINOR MODE

(defvar-keymap my-global-minor-mode-map :doc “For the minor modr” “SPC” my-global-map)

(define-minor-mode my-global-minor-mode “A global minor mode so that my key settings override annoying major modes.” :init-value t :lighter “minor mode keychords” :keymap my-global-minor-mode-map )

(my-global-minor-mode t)

(defun my-minibuffer-setup-hook () (my-global-minor-mode 0))

(add-hook ‘minibuffer-setup-hook ‘my-minibuffer-setup-hook)

(add-hook ‘after-load-functions ‘my-keys-have-priority)

(defun my-keys-have-priority (_file) “Try to ensure that my keybindings retain priority over other minor modes.

Called via the `after-load-functions’ special hook.” (unless (eq (caar minor-mode-map-alist) ‘my-global-minor-mode) (let ((mykeys (assq ‘my-global-minor-mode minor-mode-map-alist))) (assq-delete-all ‘my-global-minor-mode minor-mode-map-alist) (add-to-list ‘minor-mode-map-alist mykeys))))

;;(define-globalized-minor-mode global-my-mode my-global-minor-mode my-global-minor-mode)

;;(add-to-list ‘emulation-mode-map-alists `((my-global-minor-mode . ,my-global-minor-mode-map)))

;; (add-hook ‘after-load-functions ‘my-keys-have-priority)

;; (defun my-keys-have-priority (_file) ;; “Try to ensure that my keybindings retain priority over other minor modes.

;; Called via the `after-load-functions’ special hook.” ;; (unless (eq (caar minor-mode-map-alist) ‘my-keys-minor-mode) ;; (let ((mykeys (assq ‘my-keys-minor-mode minor-mode-map-alist))) ;; (assq-delete-all ‘my-keys-minor-mode minor-mode-map-alist) ;; (add-to-list ‘minor-mode-map-alist mykeys))))

PROGRAMMING

(use-package emacs
  :ensure nil
  :hook 
  (prog-mode . electric-indent-local-mode)
  (prog-mode . electric-pair-local-mode)
  )

(add-hook 'c++-mode-hook #'(lambda () (hs-minor-mode 1)))
(add-hook 'c-mode-hook #'(lambda () (hs-minor-mode 1)))
;;(add-to-list 'auto-mode-alist '("\\.org\\'" . org-display-inline-images))

DAPE

(use-package dape)

GETTINGS THINGS DONE

This section covers some configuration of org mode and org agenda so you get a GTD-esque experience. It’s based off of this guide https://www.labri.fr/perso/nrougier/GTD/index.html by Nicolas P. Rougier.

(use-package emacs
  :ensure nil
  :after org
  :config
  ;; Files
  (setq org-directory "~/Notes/GTD/")
  (setq org-agenda-files (list "inbox.org" "projects.org" "agenda.org"))

  ;; Capture
  (setq org-capture-templates
	`(("i" "Inbox" entry (file "inbox.org")
           ,(concat "* TODO %?\n" "/Entered on/ %U")
           :prepend top
           :empty-lines-before 1)
          ("p" "Project" entry (file "projects.org")
           ,(concat "* TODO %? [/]\n" "/Entered on/ %U\n"))
          ("s" "Scheduled" entry (file+headline "agenda.org" "Future")
           ,(concat "* TODO %? \n" "SCHEDULED: <%^{yyyy-mm-dd}>")) ;; run a keybinding maybe?
          ("d" "Deadline" entry (file+headline "agenda.org" "Future")
           ,(concat "* TODO %? \n" "DEADLINE: <%^{yyyy-mm-dd}>"))
          ("r" "Recurrent" entry (file+headline "agenda.org" "Recurrent")
           ,(concat "* Reccurent event %?\n"))))

  (add-hook 'org-capture-mode-hook 'delete-other-windows) ;; Use full window for org-capture

  ;; it was getting to me and this was the only solution look up this exact var in org-capture.el or in the evil heading for an alternative way
  ;; (defvar org-capture-mode-map
  ;;   (let ((map (make-sparse-keymap)))
  ;;     (define-key map "ZZ" #'org-capture-finalize)
  ;;     (define-key map "ZQ" #'org-capture-kill)
  ;;     (define-key map "ZR" #'org-capture-refile)
  ;;     map)
  ;;   "remap some keys")

;; Refile
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps nil)
(setq org-refile-targets '(("projects.org" :maxlevel . 4) ("inbox.org" :maxlevel . 1)))

;; TODO
(setq org-todo-keywords
      '((sequence "TODO(t)" "NEXT(n)" "HOLD(h)" "|" "COMPLETE(c)")))

(setq org-log-done 'time) ;; add closed property to todo entries

(defun log-todo-next-creation-date (&rest ignore)
  "Log NEXT creation time in the property drawer under the key 'ACTIVATED'"
  (when (and (string= (org-get-todo-state) "NEXT")
             (not (org-entry-get nil "ACTIVATED")))
    (org-entry-put nil "ACTIVATED" (format-time-string "[%Y-%m-%d]"))))

(add-hook 'org-after-todo-state-change-hook #'log-todo-next-creation-date)

;; Projects


;; Agenda
(setq org-agenda-window-setup 'current-window)
(setq org-agenda-span 1) ;; number of days to include in overview display
(setq org-agenda-hide-tags-regexp ".") ;; hide filetags everywhere

(setq org-global-properties '(("Effort_ALL". "0:00 0:05 0:10 0:15 0:20 0:30 0:45 1:00 2:00 3:00 4:00 infinity")))
(setq org-agenda-custom-commands
      '(("g" "Get Things Done (GTD) view"
         ((agenda ""
                  ((org-agenda-skip-function
                    '(org-agenda-skip-entry-if 'deadline))
                   (org-deadline-warning-days 0)))
          (todo "NEXT"
                ((org-agenda-skip-function
                  '(org-agenda-skip-entry-if 'deadline))
                 (org-agenda-prefix-format "  %i %-12:c [%e] ")
                 (org-agenda-overriding-header "\nTasks\n")))
          (agenda nil
                  ((org-agenda-entry-types '(:deadline))
                   (org-agenda-format-date "")
                   (org-deadline-warning-days 14) ;; 14 is default 7 is just too quick
                   (org-agenda-overriding-header "\nDeadlines")))

	  ;; (tags "+projects+LEVEL=\"1\"+TODO=\"NEXT\""
          ;;       ((org-agenda-prefix-format "  %?-12t% s")
          ;;        (org-agenda-overriding-header "\nActive Project\n")))
	  ;; when u learn elisp write a function to automatically display the subtasks of a project entry marked with next
	  (tags "+activeproject+projects+LEVEL=\"1\""
                ((org-agenda-prefix-format "  %?-12t% s")
                 (org-agenda-overriding-header "\nActive Project\n")))
	  (tags-todo "+activeproject+projects-LEVEL=\"1\""
                ((org-agenda-prefix-format "  %?-12t% s")
                 (org-agenda-overriding-header "\nand its tasks\n")))
	  ;; extremely hacky but i looked into the alternatives they dont exist ^
	  (tags "+projects+LEVEL=\"1\"-TODO=\"NEXT\""
                ((org-agenda-prefix-format "  %?-12t% s")
                 (org-agenda-overriding-header "\nProjects\n")))

          (tags-todo "inbox"
                     ((org-agenda-prefix-format "  %?-12t% s")
                      (org-agenda-overriding-header "\nInbox\n")))
          (tags "CLOSED>=\"<today>\""
                ((org-agenda-overriding-header "\nCompleted today\n")))))))
)

GIT

Git related plugins are here

Git Time Machine

(use-package git-timemachine
  :after git-timemachine
  :hook (evil-normalize-keymaps . git-timemachine-hook)
  :config
    (evil-define-key 'normal git-timemachine-mode-map (kbd "C-j") 'git-timemachine-show-previous-revision)
    (evil-define-key 'normal git-timemachine-mode-map (kbd "C-k") 'git-timemachine-show-next-revision)
)

Magit

Magit is like the

(use-package
 magit
 :custom
 (vc-handled-backends nil)
 (magit-section-initial-visibility-alist '((untracked . show)))
 :config
 (add-hook 'magit-process-find-password-functions 'magit-process-password-auth-source)) ;; automatically find git credentials, the first function doesnt exist so i have no idea how this works

Git gutter

(use-package git-gutter :hook (prog-mode . git-gutter))

LANGUAGE SUPPORT

Emacs has built-in programming language modes for Lisp, Scheme, DSSSL, Ada, ASM, AWK, C, C++, Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles, Metafont, Modula2, Object Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, Prolog, Python, Ruby, Simula, SQL, Tcl, Verilog, and VHDL. Other languages will require you to install additional modes.

;;(use-package lua-mode)
;;(use-package haskell-mode)

LATEX

NOT CONFIGURED

(use-package emacs
  :ensure nil
  :hook 
  (latex-mode . electric-indent-local-mode)
  (latex-mode . electric-pair-local-mode)
)

;; (require 'general)
;; ;;(leader-key latexmk, and clean keybinding, and view keybinding
;; (leader-global
;;   "l" '(:ingore t :wk "Latex")
;;   "lc" '((lambda () (interactive) (shell-command (format "/usr/bin/pdflatex" (shell-quote-argument (buffer-file-name))) ) ) :wk "Latex compile") ;; make it grab the current string of the open tex file
;;   "lv" '((lambda () (interactive) (dired buffer-file-name)) :wk "Latex view compiled"))

Modes

(add-hook 'LaTeX-mode-hook 'lsp)
(setq TeX-parse-self t)
;;(add-to-list 'auto-mode-alist '("\\.tex\\'" . 'lsp))

AUCTeX

(use-package auctex)

PDF viewer

theres probably a better way to do this

(add-to-list 'auto-mode-alist '("\\.pdf\\'" . doc-view-mode))

Org latex preview

(setq org-preview-latex-default-process 'dvipng)

ORG-MODE

Disable / enable features

Enabling Table of Contents

(use-package
 toc-org
 :commands toc-org-enable
 :init (add-hook 'org-mode-hook 'toc-org-enable))

Enabling Org Bullets

Org-bullets gives us attractive bullets rather than asterisks.

(use-package
 org-bullets
 :config
 (add-hook 'org-mode-hook 'org-indent-mode)
 (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))

Enabling Inline images

(setq org-startup-with-inline-images t)
(setq org-image-actual-width nil)

Disable electric indent

(electric-indent-mode -1)
(electric-pair-mode -1)
(setq org-edit-src-content-indentation 0)

Hide emphasis marks

(setq org-hide-emphasis-markers t)

Tempo

This enables <q and <s behavior for blocks, org-tempo is not a separate package but a module within org that can be enabled.

Typing the below + TABExpands to …
<a’#+BEGIN_EXPORT ascii’ … ‘#+END_EXPORT
<c’#+BEGIN_CENTER’ … ‘#+END_CENTER’
<C’#+BEGIN_COMMENT’ … ‘#+END_COMMENT’
<e’#+BEGIN_EXAMPLE’ … ‘#+END_EXAMPLE’
<E’#+BEGIN_EXPORT’ … ‘#+END_EXPORT’
<h’#+BEGIN_EXPORT html’ … ‘#+END_EXPORT’
<l’#+BEGIN_EXPORT latex’ … ‘#+END_EXPORT’
<q’#+BEGIN_QUOTE’ … ‘#+END_QUOTE’
<s’#+BEGIN_SRC’ … ‘#+END_SRC’
<v’#+BEGIN_VERSE’ … ‘#+END_VERSE’
(require 'tempo)

Tempel

Font lock keywords

(font-lock-add-keywords
 'org-mode
 '(("^ *\\([-]\\) " (0 (prog1 ()
         (compose-region (match-beginning 1) (match-end 1) ""))))))
;; add X emoji for - [X] yada yada

Org back links

;;(use-package org-backlink :ensure (:host github :repo "codecoll/org-backlink"))

ORG-DOWNLOAD

Drag and drop images into org-mode .

(use-package org-download
  :config
  (setq org-download-image-dir "~/Notes/.images/")
  (add-hook 'dired-mode-hook 'org-download-enable))

POMODORO

Pomodoro is a productivity technique here is a simple implementation using org timer.

(use-package emacs
  :ensure nil
  :after evil ;;org-timer
  ;; i want it to work automatically clock in time
  ;; maybe start another 5 minute timer??
  :demand t
  :config
  ;; (add-hook 'org-timer-done-hook #'org-clock-out) ;; when the timer runs out
  ;; (add-hook 'org-clock-out-hook #'org-timer-pause-or-continue) ;; when i clock out, add some extra logic
  ;; (setq org-timer-mode-line-string nil)
  ;; (add-hook 'org-clock-in-hook #'org-timer-set-timer)
  ;; (add-hook 'org-clock-in-hook #'(not org-timer-mode-line-string)
  ;; (add-hook 'org-clock-in-hook #'(if (and org-timer-mode-line-string nil) (lambda () (interactive) (org-timer-pause-or-continue) (org-timer-set-timer "00:25:00"))))
  (setq org-clock-sound "~/.config/emacs/sounds/Bicycle-bell-2.wav")
  (setq org-timer-default-timer 25))

SHELLS AND TERMINALS

CONFIGURED I THINK

eshell

eshell is an emacs ‘shell’ written in elisp

(use-package
 eshell-syntax-highlighting
 :after esh-mode
 :config (eshell-syntax-highlighting-global-mode +1))

;; eshell-syntax-highlighting -- adds fish/zsh-like syntax highlighting.
;; eshell-rc-script -- your profile for eshell; like a bashrc for eshell.
;; eshell-aliases-file -- sets an aliases file for the eshell.

(setq
 eshell-rc-script (concat user-emacs-directory "eshell/profile")
 eshell-aliases-file (concat user-emacs-directory "eshell/aliases")
 eshell-history-size 5000
 eshell-buffer-maximum-lines 5000
 eshell-hist-ignoredups t
 eshell-scroll-to-bottom-on-input t
 eshell-destroy-buffer-when-process-dies t
 eshell-visual-commands' ("bash" "fish" "htop" "ssh" "top" "zsh" "btop" "glances"))

vterm

(use-package
 vterm
 :config
 (setq
  vterm-shell "/usr/bin/fish"
  vterm-max-scrollback 5000))

vterm toggle

(use-package
 vterm-toggle
 :after vterm
 :config
 (setq vterm-toggle-fullscreen-p nil)
 (setq vterm-toggle-scope 'project)
 (add-to-list
  'display-buffer-alist
  '((lambda (buffer-or-name _)
      (let ((buffer (get-buffer buffer-or-name)))
        (with-current-buffer buffer
          (or (equal major-mode 'vterm-mode)
              (string-prefix-p
               vterm-buffer-name (buffer-name buffer))))))
    (display-buffer-reuse-window display-buffer-at-bottom)
    ;;(display-buffer-reuse-window display-buffer-in-direction)
    ;;display-buffer-in-direction/direction/dedicated is added in emacs27
    ;;(direction . bottom)
    ;;(dedicated . t) ;dedicated is supported in emacs27
    (reusable-frames . visible) (window-height . 0.3))))

multivterm

(use-package multi-vterm
	:config
	(add-hook 'vterm-mode-hook
			(lambda ()
			(setq-local evil-insert-state-cursor 'box)
			(evil-insert-state)))
	(define-key vterm-mode-map [return]                      #'vterm-send-return)

	(setq vterm-keymap-exceptions nil))

SNIPPETS

NOT CONFIGURED

Yasnippet

(use-package
 yasnippet
 :ensure t
 :config
 ;;(setq yas-snippet-dirs '("~/.config/emacs/snippets" "~/.config/emacs/elpaca/repos/yasnippet-snippets/snippets/"))
 (yas-global-mode 1))

Yasnippet-snippets

(use-package yasnippet-snippets
  :ensure t
  :hook
  (prog-mode . yas-minor-mode)
  :bind
  (("C-c y n" . yas-new-snippet)
   ("C-c y v" . yas-visit-snippet-file)
   ("C-c y i" . yas-insert-snippet))
  :config
  (yas-reload-all))

Yasnippet-capf

(use-package yasnippet-capf
  :after cape
  :ensure t
  :config
(setq yasnippet-capf-lookup-by 'name) ;; Prefer the name of the snippet instead
)

UNDO

Undo related configuration, includes plugins and default variables.

undo limits

Here we set the default emacs undo limits.

(setq undo-limit 67108864) ;; 64mb.
(setq undo-strong-limit 100663296) ;; 96mb.
(setq undo-outer-limit 134217728) ;; 128mb.

vundo

Visualize the undo tree.

(use-package
 vundo
 :config (setq vundo-glyph-alist vundo-unicode-symbols) (setq vundo-window-side 'top))

undo-fu

Undo helper with redo.

(use-package undo-fu)

undo-fu session

Save and recover undo steps between emacs sessions>

(use-package undo-fu-session
  :config
  (setq undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
  (setq undo-fu-session-directory "~/.cache/undo-fu-session/")
  (undo-fu-session-global-mode))

EMACS PACKAGES

EMMS

(use-package emms :config 
  (require 'emms-player-mpv)
(setq emms-player-list '(emms-player-mpv)))

EGLOT

(use-package
 eglot
 :ensure nil
 :config
 (setq eglot-autoshutdown t)
 ;; tell eglot what lsps are avilable
 ;;(add-to-list 'eglot-server-programs '(c++-mode . ("clangd"))) ;; not necessary
 (add-to-list 'eglot-server-programs '(latex-mode . ("texlab")))
 ;; start eglot
 (add-hook 'prog-mode-hook 'eglot-ensure) ;;start eglot session if there isnt one in buffer
 (add-hook 'latex-mode-hook 'eglot-ensure)
 ;; this fixes a bug, https://github.com/joaotavora/eglot/discussions/1127 https://www.reddit.com/r/emacs/comments/175moy8/eglot_gets_out_of_sync_from_the_buffer_and/
 ;; https://github.com/minad/corfu/discussions/400
 (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
 (advice-add 'eglot-completion-at-point :around #'cape-wrap-noninterruptible)
 )

FLYMAKE

On-the-fly syntax checking built-in Emacs!

(use-package emacs
  :ensure nil
  :config
 ;; (setq flymake-indicator-type nil)
 ;; (setq flymake-margin-indicators-string nil)
  ;;(setq flymake-show-diagnostics-at-end-of-line t) actually quite annoying imo
)

FLYMAKE-COLLECTION

Collection of checkers for flymake

(use-package flymake-collection
  :hook (after-init . flymake-collection-hook-setup))

FLYMAKE-FLYCHECk

Use any emacs flycheck checker as a flymake backend!

(use-package flymake-flycheck
:config
(add-hook 'flymake-mode-hook 'flymake-flycheck-auto)
(add-to-list 'flycheck-disabled-checkers 'sh-shellcheck)) ;; if you find that flymake is now running flycheck checkers which are redundant add them to this list

REPEAT-MODE

enable it

(use-package repeat-mode
  :ensure nil
  :hook (after-init . repeat-mode))

TRAMP

EASY-PG

(setq epa-pinentry-mode 'loopback)

WHICH-KEY

which-key is a minor mode for Emacs that displays the key bindings following your currently entered incomplete command (a prefix) in a popup.

(use-package which-key
  :ensure nil ;; included in emacs 30 yay
  :hook (after-init . which-key-mode)
  :config
  ;; revisit these options (learn what they do and the keep them if they are good
  (setq
   which-key-side-window-location 'bottom
   which-key-sort-order #'which-key-key-order
   which-key-sort-uppercase-first nil
   which-key-add-column-padding 1
   which-key-max-display-columns nil
   which-key-min-display-lines 6
   which-key-side-window-slot -10
   which-key-side-window-max-height 0.25
   which-key-idle-delay 0.8
   which-key-max-description-length 25
   which-key-allow-imprecise-window-fit nil
   which-key-separator ""))

SAVEHIST

(savehist-mode)

COMMUNITY PACKAGES

EVIL

(use-package
 evil
 :init ;; tweak evil's configuration before loading it
 (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
 (setq evil-want-keybinding nil)
 (setq evil-vsplit-window-right t)
 (setq evil-split-window-below t)
 (setq evil-undo-system 'undo-fu)
 (setq evil-want-C-u-scroll t)
 (evil-mode)
 ;;(evil-define-key 'insert evil-insert-state-map (kbd "jj") 'evil-normal-state)
 ;;(global-set-key [remap evil-quit] 'evil-window-delete) ;; FIGURE THIS OUT PLEASE
)

(use-package
 evil-collection
 :after evil
 :config
 ;;(setq evil-collection-mode-list '(dashboard dired ibuffer neotree magit vundo doc-view help elpaca package-menu buff-menu imenu buffer apropos cmake-mode snake tetris vterm vertico corfu eat eww))
 (evil-collection-init))

(use-package evil-tutor)

custom evil setups

custom evil setups for different modes

EVIL-ORG-AGENDA

Taken from here https://github.com/Somelauw/evil-org-mode/blob/master/evil-org-agenda.el

;; you can set normal mode in it and then just use it like a regular buffer, with spc w h but its a bit unintuitive especially if you have like only 1 thing to change
(defun evil-org-agenda-set-keys ()
  "Set motion state keys for `org-agenda'."
  (evil-set-initial-state 'org-agenda-mode 'motion)

  (evil-define-key 'motion org-agenda-mode-map

    ;; open
    (kbd "<tab>") 'org-agenda-goto
    (kbd "S-<return>") 'org-agenda-goto
    (kbd "g TAB") 'org-agenda-goto
    (kbd "RET") 'org-agenda-switch-to
    (kbd "M-RET") 'org-agenda-recenter

    (kbd "SPC") 'org-agenda-show-and-scroll-up
    (kbd "<delete>") 'org-agenda-show-scroll-down
    (kbd "<backspace>") 'org-agenda-show-scroll-down

    ;; motion
    "j" 'org-agenda-next-line
    "k" 'org-agenda-previous-line
    "gj" 'org-agenda-next-item
    "gk" 'org-agenda-previous-item
    "gH" 'evil-window-top
    "gM" 'evil-window-middle
    "gL" 'evil-window-bottom
    (kbd "C-j") 'org-agenda-next-item
    (kbd "C-k") 'org-agenda-previous-item
    (kbd "[[") 'org-agenda-earlier
    (kbd "]]") 'org-agenda-later

    ;; manipulation
    ;; We follow standard org-mode bindings (not org-agenda bindings):
    ;; <HJKL> change todo items and priorities.
    ;; M-<jk> drag lines.
    ;; M-<hl> cannot demote/promote, we use it for "do-date".
    "J" 'org-agenda-priority-down
    "K" 'org-agenda-priority-up
    "H" 'org-agenda-do-date-earlier
    "L" 'org-agenda-do-date-later
    "t" 'org-agenda-todo
    (kbd "M-j") 'org-agenda-drag-line-forward
    (kbd "M-k") 'org-agenda-drag-line-backward
    (kbd "C-S-h") 'org-agenda-todo-previousset ; Original binding "C-S-<left>"
    (kbd "C-S-l") 'org-agenda-todo-nextset ; Original binding "C-S-<right>"

    ;; undo
    "u" 'org-agenda-undo

    ;; actions
    "dd" 'org-agenda-kill
    "dA" 'org-agenda-archive
    "da" 'org-agenda-archive-default-with-confirmation
    "ct" 'org-agenda-set-tags
    "ci" 'org-agenda-refile
    "ce" 'org-agenda-set-effort
    "cT" 'org-timer-set-timer
    "i" 'org-agenda-diary-entry
    "a" 'org-agenda-add-note
    "A" 'org-agenda-append-agenda
    "C" 'org-agenda-capture

    ;; mark
    "m" 'org-agenda-bulk-toggle
    "~" 'org-agenda-bulk-toggle-all
    "*" 'org-agenda-bulk-mark-all
    "%" 'org-agenda-bulk-mark-regexp
    "M" 'org-agenda-bulk-unmark-all
    "x" 'org-agenda-bulk-action

    ;; refresh
    "gr" 'org-agenda-redo
    "gR" 'org-agenda-redo-all

    ;; quit
    "ZQ" 'org-agenda-exit
    "ZZ" 'org-agenda-quit

    ;; display
    ;; "Dispatch" can prefix the following:
    ;; 'org-agenda-toggle-deadlines
    ;; 'org-agenda-toggle-diary
    ;; 'org-agenda-follow-mode
    ;; 'org-agenda-log-mode
    ;; 'org-agenda-entry-text-mode
    ;; 'org-agenda-toggle-time-grid
    ;; 'org-agenda-day-view
    ;; 'org-agenda-week-view
    ;; 'org-agenda-year-view
    "gD" 'org-agenda-view-mode-dispatch
    "ZD" 'org-agenda-dim-blocked-tasks

    ;; filter
    "sc" 'org-agenda-filter-by-category
    "sr" 'org-agenda-filter-by-regexp
    "se" 'org-agenda-filter-by-effort
    "st" 'org-agenda-filter-by-tag
    "s^" 'org-agenda-filter-by-top-headline
    "ss" 'org-agenda-limit-interactively
    "S" 'org-agenda-filter-remove-all

    ;; clock
    "I" 'org-agenda-clock-in ; Original binding
    "O" 'org-agenda-clock-out ; Original binding
    "cg" 'org-agenda-clock-goto
    "cc" 'org-agenda-clock-cancel
    "cr" 'org-agenda-clockreport-mode

    ;; go and show
    "." 'org-agenda-goto-today ; TODO: What about evil-repeat?
    "gc" 'org-agenda-goto-calendar
    "gC" 'org-agenda-convert-date
    "gd" 'org-agenda-goto-date
    "gh" 'org-agenda-holidays
    "gm" 'org-agenda-phases-of-moon
    "gs" 'org-agenda-sunrise-sunset
    "gt" 'org-agenda-show-tags

    "p" 'org-agenda-date-prompt
    "P" 'org-agenda-show-the-flagging-note

    ;; 'org-save-all-org-buffers ; Original binding "C-x C-s"

    ;; Others
    "+" 'org-agenda-manipulate-query-add
    "-" 'org-agenda-manipulate-query-subtract))

(add-hook 'org-agenda-mode-hook #'evil-org-agenda-set-keys)
EVIL-HELP

I can’t use my leader SPC key in help mode it’s bound to scroll-down in that mode. I also tried setting up a global minor mode but that did not turn out all too well.

(use-package emacs
  :ensure nil
  :config
  (defun evil-help-state ()
    "Set motion state for `help-mode'."
    (evil-set-initial-state 'help-mode 'motion))
  (add-hook 'help-mode-hook #'evil-help-state))
EVIL-ORG-CAPTURE-MODE-HOOK
(use-package emacs
  :ensure nil
  :config
  (defun evil-org-capture-buffer ()
    "ZZ ZR ZQ for org capture buffer"
    (evil-define-key '(normal visual motion emacs) org-capture-mode-map
      "ZZ" 'org-capture-finalize
      "ZR" 'org-capture-refile
      "ZQ" 'org-capture-kill)) 
  (add-hook 'org-capture-mode-hook 'evil-org-capture-buffer))
EVIL-ORG-ROAM-CAPTURE
(use-package emacs
  :ensure nil
  :config
  (defun evil-org-roam-capture-keys ()
    "ZZ ZQ for org roam capture buffer"
    (evil-define-key '(normal visual motion emacs) org-roam-mode-map
      "ZZ" 'org-capture-finalize
      "ZQ" 'org-capture-kill)) 
  (add-hook 'org-capture-mode-hook 'evil-org-roam-capture-keys))
EVIL-ORG-ADD-NOTE
(use-package emacs
  :ensure nil
  :config
  (defun evil-org-add-note ()
    "ZZ ZQ for org add note buffer"
    (evil-define-key '(normal visual motion emacs) org-mode-map
      "ZZ" 'org-ctrl-c-ctrl-c
      "ZQ" 'org-kill-note-or-show-branches))
  ;;:hook (org-mode . evil-org-add-note)) ;; define a custom hook for org-agenda-add-note
  )
;;change the text that shows up as well

EVIL-SURROUND

learn how to use this

(use-package evil-surround
  :ensure t
  :config
  (global-evil-surround-mode 1))

EVIL-SNIPE

Disable viper

(use-package viper :disabled)

ACTIVITIES

Suspend, discard, revert, resume activities, that is frames/tabs and their windows, buffers. Kind of like a mix between desktop-save mode and a workspace.

(use-package
 activities
 :init (activities-mode)
 (setq edebug-inhibit-emacs-lisp-mode-bindings t) ;; Prevent `edebug' default bindings from interfering.
 (setq activities-kill-buffers t) ;; kill buffers when suspending
 :config
 (cl-defun activities-define-forcep (name) 
   ;; it was easier to do it like this
   "Define current state as a new activity with NAME.
Always redefines existing activity."
   (interactive
    (let* ((current-activity-name
            (when-let ((current-activity (activities-current)))
              (activities-activity-name current-activity)))
           (default (or current-activity-name (funcall activities-default-name-fn))))
      (list (read-string (format-prompt "New activity name" default) nil nil default))))
   ;; `forcep` is always true, so skip the duplicate name check
   (let ((activity (make-activities-activity :name name)))
     (activities--set activity)
     (activities-save activity :defaultp t :lastp t)
     (when activities-bookmark-store
       (activities-bookmark-store activity))
     (activities--switch activity)
     activity)))

ALL THE ICONS

Note you have to run the all-the-icons-install-fonts command so it actually installs the fonts

(use-package all-the-icons :ensure t :if (display-graphic-p))

(use-package
 all-the-icons-dired
 :hook (dired-mode . (lambda () (all-the-icons-dired-mode t))))

CAPE

this bit can use some rewriting, if only you put where you got it from https://github.com/Gavinok/emacs.d

(use-package
 cape
 :ensure t
 :defer 10
 :init
 (add-hook 'completion-at-point-functions #'cape-file) ;; you can complete files /bin/
 (add-hook 'completion-at-point-functions #'cape-dabbrev) ;; dabbrev pretty cool
 (add-hook 'completion-at-point-functions #'cape-dict) ;; dabbrev pretty cool
 (add-hook 'completion-at-point-functions #'yasnippet-capf) ;; yasnippets
 (add-hook 'completion-at-point-functions #'cape-tex)
 (add-hook 'completion-at-point-functions #'cape-elisp-block)

;; (defun my/eglot-capf ()
;;   (setq-local completion-at-point-functions
;;               (list (cape-capf-super
;;                      #'eglot-completion-at-point
;;                      #'yasnippet-capf))))
;; ;; make functions by language(mode) so you can enable dabbrev for tex
;; ;; make yasnippets load sepperately form everything else

;; (add-hook 'eglot-managed-mode-hook #'my/eglot-capf) 

 ;;this bit causes the ) to disappear ^ the function and hook
)

COLORFUL-MODE

Preview any color in the buffer.

(use-package colorful-mode
 :ensure t
 :defer t
 :diminish
 :hook ((org-mode prog-mode) . colorful-mode))

CORFU

COmpletion in Region FUnction. Corfu enhances in-buffer completion with a small completion popup. The current candidates are shown in a popup below or above the point, and can be selected by moving up and down. Corfu is the minimalistic in-buffer completion counterpart of the Vertico minibuffer UI.

(use-package
 corfu
 :ensure t
 :custom
 (corfu-cycle t) ;; allow cycling through candidates
 (corfu-auto t) ;; enable auto completion
 (corfu-auto-prefix 1) ;; minimum length for auto completion
 (corfu-auto-delay 0) ;; no delay might cause problems, like ) going away NVM THIS ISNT IT EITHER
 (corfu-popupinfo-delay '(0.5 . 0.2)) ;; vscode-like popups
 (corfu-echo-documentation t)
 (corfu-preselect 'prompt) ;; always preselect the prompt
 (corfu-on-exact-match nil) ;; Don't auto expand snippets
 ;;     (setq corfu-min-width 20)
 :config
 (define-key corfu-map (kbd "C-k") (kbd "<up>"))
 (define-key corfu-map (kbd "C-j") (kbd "<down>"))
 ;; supertab-like behavior
 :bind (:map corfu-map
             ("M-SPC"      . corfu-insert-separator)
             ("TAB"        . corfu-next)
             ([tab]        . corfu-next)
             ("S-TAB"      . corfu-previous)
             ([backtab]    . corfu-previous)
             ("S-<return>" . corfu-insert)
             ("RET"        . corfu-insert)) ;; corfu insert deletes the ), idk if its corfu because even just ret deletes the )
 :init
 (global-corfu-mode)
 (corfu-history-mode)
 (corfu-popupinfo-mode))

corfu emacs configurations

(use-package
 emacs
 :ensure nil
 :custom
 ;; Enable indentation+completion using the TAB key.
 ;; `completion-at-point' is often bound to M-TAB.
 (tab-always-indent 'complete)
 ;; Emacs 30 and newer: Disable Ispell completion function.
 ;; Try `cape-dict' as an alternative.
 (text-mode-ispell-word-completion nil)
 ;; Hide commands in M-x which do not apply to the current mode.
 (read-extended-command-predicate #'command-completion-default-include-p))

nerd-icons-corfu

(use-package
 nerd-icons-corfu
 :config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))

Corfu terminal

NOTE: Corfu relies on child frames to show the popup. Emacs 31 supports child frames also for terminal Emacs. On older Emacs versions, you can use the corfu-terminal package.

(use-package corfu-terminal)

CONSULT

consult-imenu consult-line consult-flymake consult-grep

(use-package consult :config (setq consult-preview-key nil))

DASHBOARD

(use-package
 dashboard
 :ensure t
 :init
 (setq initial-buffer-choice 'dashboard-open)
 (setq dashboard-set-heading-icons t)
 (setq dashboard-set-file-icons t)
 (setq dashboard-startupify-list
       '(dashboard-insert-banner
         dashboard-insert-newline
         dashboard-insert-banner-title
         dashboard-insert-newline
         dashboard-insert-init-info
	 dashboard-insert-newline
         dashboard-insert-newline
         dashboard-insert-footer
         dashboard-insert-items))
 (setq dashboard-banner-logo-title "the extensible self-documenting integrated computing environment") ;; the first program, even before GCC, the optimus programus
 ;; rewrite this 
 ;;(defun dashboard-title ()
    ;;(let ((smaller-version 
	   ;;(replace-regexp-in-string (rx " (" (zero-or-more any) eol) "" (emacs-version))
	   ;;(replace-regexp-in-string (rx "2025" (zero-or-more any) eol) "" (emacs-version))))
      ;;(string-replace "\n" "" smaller-version) 
;;)
;;)
 ;;(setq dashboard-banner-logo-title (format "%s" (dashboard-title)))
 (setq dashboard-startup-banner "~/.config/emacs/dashboard-images/emacs.png") ;; use standard emacs logo as banner
 (setq dashboard-center-content t) ;; set to 't' for centered content
 (setq dashboard-items
       '((recents . 5)
         (agenda . 5)
         (bookmarks . 3)
         (projects . 3)
         (registers . 3)))
 (setq dashboard-item-shortcuts
       '((recents . "r")
         (bookmarks . "m")
         (projects . "p")
         (agenda . "a")
         (registers . "e")))
 :custom
 (dashboard-footer-messages '("From freedom came elegance!" "where there is a shell, there is a way" "There's no place like 127.0.0.1" "free as in freedom" "If you can read this, Xorg is still working" "Powered by Gentoo" "Powered by GNU/Linux" "u like regex.. dont u?" "Richard Stallman is proud of you" "“Talk is cheap. Show me the code.” \n         - Linus Torvalds" "“Well, what is a computer? A computer is a universal machine.” \n                       - Richard Stallman" "UNIX! Live Free or Die" "Linux is user friendly. It's just very picky about who its friends are." " “Intelligence is the ability to avoid doing work, yet getting the work done.” \n                               - Linus Torvalds" "Monolithic Multipurpose Xenodochial Xsystem" "Keep it simple, stupid!" "the quieter you become, the more you are able to hear" "Designed for GNU/Linux" "Certified for Microsoft© Windows™" "Certified for Windows Vista™" "Compatible with Windows®7" "Works with Windows Vista™" "Microsoft© Windows™ Capable" "Emacs is written in Lisp, which is the only computer language that is beautiful" "I showed you my source code, plz respond" "Configured by mpetco" "8MBs and constantly swapping" "a great operating system, lacking only a decent editor" "Eight Megabytes and Constantly Swapping" "Escape Meta Alt Control Shift" "EMACS Makes Any Computer Slow" "Eventually Munches All Computer Storage" "Generally Not Used, Except by Middle-Aged Computer Scientists" "How do you generate a random string? \n Put a web designer in front of vim" "vim is the leading cause of arthritis" "Given enough eyeballs all bugs are shallow" "“An idiot admires complexity, a genius admires simplicity”" "A great lisp interpreter" "lisp machine reference goes here" "lisp mathematical notation reference goes here" "The Optimus Programus" "Before There Was GCC, There Was Emacs" "The UNIX philosophy at it's finest" "The First Program, even before GCC" "Born in the Time of Terminals, Thriving still" "The One Editor to Rule Them All" "Eigth Wonder of the Coding World" "When RMS Dreamt in Lisp" "The UNIX Way, Amplified" "vim is a plugin" "Pure Lisp, Pure Bliss" "In Unix We Trust, in Emacs We Code" "A Pipe is Only as Strong as its Editor" "The Supreme Editor (by Decree)" "The Emperor's New Editor" "Bhraman in Lisp" "The Code of Daedulus" "The Tao of the computer" "the IDE of the project" "pontifex sexpius" "Liberty, when it begins to take root, is a plant of rapid growth." "I am at your command ~$ _" "Simplicity is the ultimate sophistication Davinci" "i use arch btw" "Linux, because freedom" "grand theft gentoo" "ubuntu linux for human beings" "The Power To Serve" "I spend more time customizing my computer then actually using it" "Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish. Neal Stephenson" "The Universal Operating System" "computers will be fun again..."))
 (dashboard-footer-icon nil)
 (dashboard-modify-heading-icons
  '((recents . "file-text") (bookmarks . "book")))
 :config
 (add-hook 'elpaca-after-init-hook #'dashboard-insert-startupify-lists)
 (add-hook 'elpaca-after-init-hook #'dashboard-initialize)
 (dashboard-setup-startup-hook))

DIMINISH

This package implements hiding or abbreviation of the modeline displays (lighters) of minor-modes. With this package installed, you can add ‘:diminish’ to any use-package block to hide that particular mode in the modeline.

(use-package diminish)

DIRED EXTRAS

dired table with dired usage commands rename move delete eetc r - redisplay D - delete

(use-package dired-open-with :defer t :ensure t)
;;(defun dpautoload-function () (message "test")) the functions has to be actually defined fyi

(use-package
 dired-preview
 :ensure t
 :defer t
 :commands dired-preview-mode
 :init (add-hook 'dired-mode-hook 'dired-preview-mode)
 :config (setq dired-preview-delay 0.3)
 (evil-define-key 'normal dired-mode-map (kbd "h") 'dired-up-directory)
 (evil-define-key 'normal dired-mode-map (kbd "l") (kbd "RET")))

DOOM-MODELINE

(use-package doom-modeline
  :ensure t
  :init (doom-modeline-mode 1)
  :custom
  ;; If non-nil, cause imenu to see `doom-modeline' declarations.
  ;; This is done by adjusting `lisp-imenu-generic-expression' to
  ;; include support for finding `doom-modeline-def-*' forms.
  ;; Must be set before loading doom-modeline.
  (doom-modeline-support-imenu t)

  ;; How tall the mode-line should be. It's only respected in GUI.
  ;; If the actual char height is larger, it respects the actual height.
  (doom-modeline-height 25)

  ;; How wide the mode-line bar should be. It's only respected in GUI.
  (doom-modeline-bar-width 4)

  ;; Whether to use hud instead of default bar. It's only respected in GUI.
  (doom-modeline-hud nil)

  ;; The limit of the window width.
  ;; If `window-width' is smaller than the limit, some information won't be
  ;; displayed. It can be an integer or a float number. `nil' means no limit."
  (doom-modeline-window-width-limit 85)

  ;; Override attributes of the face used for padding.
  ;; If the space character is very thin in the modeline, for example if a
  ;; variable pitch font is used there, then segments may appear unusually close.
  ;; To use the space character from the `fixed-pitch' font family instead, set
  ;; this variable to `(list :family (face-attribute 'fixed-pitch :family))'.
  (doom-modeline-spc-face-overrides nil)

  ;; How to detect the project root.
  ;; nil means to use `default-directory'.
  ;; The project management packages have some issues on detecting project root.
  ;; e.g. `projectile' doesn't handle symlink folders well, while `project' is unable
  ;; to hanle sub-projects.
  ;; You can specify one if you encounter the issue.
  (doom-modeline-project-detection 'auto)

  ;; Determines the style used by `doom-modeline-buffer-file-name'.
  ;;
  ;; Given ~/Projects/FOSS/emacs/lisp/comint.el
  ;;   auto => emacs/l/comint.el (in a project) or comint.el
  ;;   truncate-upto-project => ~/P/F/emacs/lisp/comint.el
  ;;   truncate-from-project => ~/Projects/FOSS/emacs/l/comint.el
  ;;   truncate-with-project => emacs/l/comint.el
  ;;   truncate-except-project => ~/P/F/emacs/l/comint.el
  ;;   truncate-upto-root => ~/P/F/e/lisp/comint.el
  ;;   truncate-all => ~/P/F/e/l/comint.el
  ;;   truncate-nil => ~/Projects/FOSS/emacs/lisp/comint.el
  ;;   relative-from-project => emacs/lisp/comint.el
  ;;   relative-to-project => lisp/comint.el
  ;;   file-name => comint.el
  ;;   file-name-with-project => FOSS|comint.el
  ;;   buffer-name => comint.el<2> (uniquify buffer name)
  ;;
  ;; If you are experiencing the laggy issue, especially while editing remote files
  ;; with tramp, please try `file-name' style.
  ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
  (doom-modeline-buffer-file-name-style 'auto)

  ;; Whether display icons in the mode-line.
  ;; While using the server mode in GUI, should set the value explicitly.
  (doom-modeline-icon t)

  ;; Whether display the icon for `major-mode'. It respects option `doom-modeline-icon'.
  (doom-modeline-major-mode-icon t)

  ;; Whether display the colorful icon for `major-mode'.
  ;; It respects `nerd-icons-color-icons'.
  (doom-modeline-major-mode-color-icon t)

  ;; Whether display the icon for the buffer state. It respects option `doom-modeline-icon'.
  (doom-modeline-buffer-state-icon t)

  ;; Whether display the modification icon for the buffer.
  ;; It respects option `doom-modeline-icon' and option `doom-modeline-buffer-state-icon'.
  (doom-modeline-buffer-modification-icon t)

  ;; Whether display the lsp icon. It respects option `doom-modeline-icon'.
  (doom-modeline-lsp-icon t)

  ;; Whether display the time icon. It respects option `doom-modeline-icon'.
  (doom-modeline-time-icon t)

  ;; Whether display the live icons of time.
  ;; It respects option `doom-modeline-icon' and option `doom-modeline-time-icon'.
  (doom-modeline-time-live-icon t)

  ;; Whether to use an analogue clock svg as the live time icon.
  ;; It respects options `doom-modeline-icon', `doom-modeline-time-icon', and `doom-modeline-time-live-icon'.
  (doom-modeline-time-analogue-clock t)

  ;; The scaling factor used when drawing the analogue clock.
  (doom-modeline-time-clock-size 0.7)

  ;; Whether to use unicode as a fallback (instead of ASCII) when not using icons.
  (doom-modeline-unicode-fallback nil)

  ;; Whether display the buffer name.
  (doom-modeline-buffer-name t)

  ;; Whether highlight the modified buffer name.
  (doom-modeline-highlight-modified-buffer-name t)

  ;; When non-nil, mode line displays column numbers zero-based.
  ;; See `column-number-indicator-zero-based'.
  (doom-modeline-column-zero-based t)

  ;; Specification of \"percentage offset\" of window through buffer.
  ;; See `mode-line-percent-position'.
  (doom-modeline-percent-position '(-3 "%p"))

  ;; Format used to display line numbers in the mode line.
  ;; See `mode-line-position-line-format'.
  (doom-modeline-position-line-format '("L%l"))

  ;; Format used to display column numbers in the mode line.
  ;; See `mode-line-position-column-format'.
  (doom-modeline-position-column-format '("C%c"))

  ;; Format used to display combined line/column numbers in the mode line. See `mode-line-position-column-line-format'.
  (doom-modeline-position-column-line-format '("%l:%c"))

  ;; Whether display the minor modes in the mode-line.
  (doom-modeline-minor-modes nil)

  ;; If non-nil, a word count will be added to the selection-info modeline segment.
  (doom-modeline-enable-word-count nil)

  ;; Major modes in which to display word count continuously.
  ;; Also applies to any derived modes. Respects `doom-modeline-enable-word-count'.
  ;; If it brings the sluggish issue, disable `doom-modeline-enable-word-count' or
  ;; remove the modes from `doom-modeline-continuous-word-count-modes'.
  (doom-modeline-continuous-word-count-modes '(markdown-mode gfm-mode org-mode))

  ;; Whether display the buffer encoding.
  (doom-modeline-buffer-encoding nil)

  ;; Whether display the indentation information.
  (doom-modeline-indent-info nil)

  ;; Whether display the total line number。
  (doom-modeline-total-line-number nil)

  ;; Whether display the icon of vcs segment. It respects option `doom-modeline-icon'."
  (doom-modeline-vcs-icon t)

  ;; The maximum displayed length of the branch name of version control.
  (doom-modeline-vcs-max-length 15)

  ;; The function to display the branch name.
  (doom-modeline-vcs-display-function #'doom-modeline-vcs-name)

  ;; Whether display the icon of check segment. It respects option `doom-modeline-icon'.
  (doom-modeline-check-icon t)

  ;; If non-nil, only display one number for check information if applicable.
  (doom-modeline-check-simple-format nil)

  ;; The maximum number displayed for notifications.
  (doom-modeline-number-limit 99)

  ;; Whether display the project name. Non-nil to display in the mode-line.
  (doom-modeline-project-name t)

  ;; Whether display the workspace name. Non-nil to display in the mode-line.
  (doom-modeline-workspace-name t)

  ;; Whether display the perspective name. Non-nil to display in the mode-line.
  (doom-modeline-persp-name t)

  ;; If non nil the default perspective name is displayed in the mode-line.
  (doom-modeline-display-default-persp-name nil)

  ;; If non nil the perspective name is displayed alongside a folder icon.
  (doom-modeline-persp-icon t)

  ;; Whether display the `lsp' state. Non-nil to display in the mode-line.
  (doom-modeline-lsp t)

  ;; Whether display the GitHub notifications. It requires `ghub' package.
  (doom-modeline-github nil)

  ;; The interval of checking GitHub.
  (doom-modeline-github-interval (* 30 60))

  ;; Whether display the modal state.
  ;; Including `evil', `overwrite', `god', `ryo' and `xah-fly-keys', etc.
  (doom-modeline-modal t)

  ;; Whether display the modal state icon.
  ;; Including `evil', `overwrite', `god', `ryo' and `xah-fly-keys', etc.
  (doom-modeline-modal-icon t)

  ;; Whether display the modern icons for modals.
  (doom-modeline-modal-modern-icon t)

  ;; When non-nil, always show the register name when recording an evil macro.
  (doom-modeline-always-show-macro-register nil)

  ;; Whether display the mu4e notifications. It requires `mu4e-alert' package.
  (doom-modeline-mu4e nil)
  ;; also enable the start of mu4e-alert
  (mu4e-alert-enable-mode-line-display)

  ;; Whether display the gnus notifications.
  (doom-modeline-gnus t)

  ;; Whether gnus should automatically be updated and how often (set to 0 or smaller than 0 to disable)
  (doom-modeline-gnus-timer 2)

  ;; Wheter groups should be excludede when gnus automatically being updated.
  (doom-modeline-gnus-excluded-groups '("dummy.group"))

  ;; Whether display the IRC notifications. It requires `circe' or `erc' package.
  (doom-modeline-irc t)

  ;; Function to stylize the irc buffer names.
  (doom-modeline-irc-stylize 'identity)

  ;; Whether display the battery status. It respects `display-battery-mode'.
  (doom-modeline-battery t)

  ;; Whether display the time. It respects `display-time-mode'.
  (doom-modeline-time t)

  ;; Whether display the misc segment on all mode lines.
  ;; If nil, display only if the mode line is active.
  (doom-modeline-display-misc-in-all-mode-lines t)

  ;; The function to handle `buffer-file-name'.
  (doom-modeline-buffer-file-name-function #'identity)

  ;; The function to handle `buffer-file-truename'.
  (doom-modeline-buffer-file-truename-function #'identity)

  ;; Whether display the environment version.
  (doom-modeline-env-version t)
  ;; Or for individual languages
  (doom-modeline-env-enable-python t)
  (doom-modeline-env-enable-ruby t)
  (doom-modeline-env-enable-perl t)
  (doom-modeline-env-enable-go t)
  (doom-modeline-env-enable-elixir t)
  (doom-modeline-env-enable-rust t)

  ;; Change the executables to use for the language version string
  (doom-modeline-env-python-executable "python") ; or `python-shell-interpreter'
  (doom-modeline-env-ruby-executable "ruby")
  (doom-modeline-env-perl-executable "perl")
  (doom-modeline-env-go-executable "go")
  (doom-modeline-env-elixir-executable "iex")
  (doom-modeline-env-rust-executable "rustc")

  ;; What to display as the version while a new one is being loaded
  (doom-modeline-env-load-string "...")

  ;; By default, almost all segments are displayed only in the active window. To
  ;; display such segments in all windows, specify e.g.
  (doom-modeline-always-visible-segments '(irc))

  ;; Hooks that run before/after the modeline version string is updated
  (doom-modeline-before-update-env-hook nil)
  (doom-modeline-after-update-env-hook nil))

EAF

;;(use-package eaf :ensure '(eaf :host github :repo "emacs-eaf/emacs-application-framework") :load-path "~/.config/emacs/site-lisp/emacs-application-framework`")

ELFEED

The functions are taken from this guide https://www.bardman.dev/technology/elfeed.

(use-package
 elfeed
 :config
 (setq elfeed-db-directory "~/.cache/elfeed/")
 ;;(setq elfeed-search-filter "+unread +youtube")
;; elfeed search filter
 )

ELFEED-TUBE

(use-package elfeed-tube
  :ensure t
  :after elfeed
  :demand t
  :config
  (setq elfeed-tube-auto-save-p nil) ; default value
  (setq elfeed-tube-use-ytdlp-p nil) ;; ytdlp is slow
  (elfeed-tube-setup))
ELFEED-TUBE-MPV
(use-package elfeed-tube-mpv
  :ensure t ;; or :straight t
  :config
  
  (defun elfeed-extras () ;; theres probably a better way to do this then with a function
    "A few extras for elfeed"
    (evil-define-key '(normal visual motion emacs) elfeed-search-mode-map
      "u" 'elfeed-update-feed
      "U" 'elfeed-update
      ;;"W" 'elfeed-tube-mpv-unread)
      )
    (evil-define-key '(normal visual motion emacs) elfeed-show-mode-map
      "m" 'bookmark-set-no-overwrite
      "W" 'elfeed-tube-mpv))

  (elfeed-extras))
;; :bind (:map elfeed-show-mode-map
;;             ("C-c C-f" . elfeed-tube-mpv-follow-mode)
;;             ("C-c C-w" . elfeed-tube-mpv-where)))

ELFEED-ORG

(use-package
 elfeed-org
 :config
 (elfeed-org)
 (setq rmh-elfeed-org-files '("~/.config/emacs/elfeed.org.gpg")))

ELPHER

(use-package elpher)

EMBARK

(use-package embark)

EMBARK-CONSULT

(use-package embark-consult)

FREQKEY

(use-package keyfreq :hook (after-init . keyfreq-mode))

MARGINALIA

(use-package marginalia :ensure t :config (marginalia-mode))

ORDERLESS

Emacs completion style that matches multiple regexps in any order.

(use-package orderless
  :ensure t
  :custom
  (completion-styles '(orderless basic))
  (completion-category-defaults nil)
  (completion-category-overrides '((file (styles basic partial-completion)) (eglot (styles orderless)) (eglot-capf (styles orderless))))) ;; remove the orderless lines if you wish to go back to the advice-add way

PROJECTILE

Projectile is a project interaction library for emacs

-------------------------------------------------+-------------------+

COMMANDDESCRIPTIONKEYBINDING

-------------------------------------------------+-------------------+

projectile-find-fileFind a file in a projectSPC p f

-------------------------------------+--------+

projectile-switch-to-bufferSwitch to a different project bufferSPC p b

----------------+--------+

grep search in project

----------------+--------+

kill close project buffers

----------------+--------+

recent files in project

----------------+--------+

----------------+--------+

----------------+--------+

----------------+--------+

----------------+--------+

(use-package ripgrep)
(use-package
 projectile
 :config
 (projectile-mode 1))

THEME

Zenburn is a low-contrast color scheme.

(use-package zenburn-theme :init (load-theme 'zenburn t))

TYPIT

(use-package typit :defer t)

TRANSIENT

Transient is a library used to implement the keyboard-driven “menus” in Magit. The bundled version is very old and doesn’t work with Magit.

(use-package transient)

UNICODE-FONTS

(use-package unicode-fonts)

VERTICO

VERTical Interactive COmpletion. Vertico provides a performant and minimalistic vertical completion UI based on the default completion system. The focus of Vertico is to provide a UI which behaves correctly under all circumstances. By reusing the built-in facilities system, Vertico achieves full compatibility with built-in Emacs completion commands and completion tables. Vertico only provides the completion UI but aims to be highly flexible, extendable and modular.

(use-package
 vertico
 :ensure t
 :custom 
 (vertico-count 9)
 :init (vertico-mode)
 :config
 (define-key vertico-map (kbd "C-k") (kbd "<up>"))
 (define-key vertico-map (kbd "C-j") (kbd "<down>")))

Vertico directory

(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 packages

WEATHER-SCOUT

(use-package weather-scout :ensure (:host github :repo "hsolg/emacs-weather-scout"))

YEETUBE

(use-package yeetube
  :init (define-prefix-command 'my/yeetube-map)
  :config
  ;;(setf yeetube-mpv-disable-video t) ;; Disable video output
  :bind (("C-c y" . 'my/yeetube-map)
          :map my/yeetube-map
		  ("s" . 'yeetube-search)
		  ("b" . 'yeetube-play-saved-video)
		  ("o" . 'yeetube-download-videos)
		  ("d" . 'yeetube-remove-saved-video)))

PLAYZONE

A play place where I can test and have fun with certain configurations and packages, if I deem them useful I add them to my config.

EXWM

(defun efs/exwm-update-class ()
  (exwm-workspace-rename-buffer exwm-class-name))

(use-package exwm
  :config
  ;; Set the default number of workspaces
  (setq exwm-workspace-number 5)

  ;; When window "class" updates, use it to set the buffer name
  (add-hook 'exwm-update-class-hook #'efs/exwm-update-class)

  ;; Rebind CapsLock to Ctrl
  ;; (start-process-shell-command "xmodmap" nil "xmodmap ~/.emacs.d/exwm/Xmodmap")

  ;; Load the system tray before exwm-init
  (exwm-systemtray-mode 1)

  ;; cant use SPC
  ;; ;; These keys should always pass through to Emacs
  (setq exwm-input-prefix-keys
    '(?\C-x
      ?\C-u
      ?\C-h
      ?\M-x
      ;;?\SPC-wh
      ?\M-`
      ?\M-&
      ?\M-:
      ?\C-\M-j  ;; Buffer list
      ?\C-\ ))  ;; Ctrl+Space

  ;; Ctrl+Q will enable the next key to be sent directly
  (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)

  ;; Set up global key bindings.  These always work, no matter the input state!
  ;; Keep in mind that changing this list after EXWM initializes has no effect.
  ;; dont rely on these for jack just getting out and into the regular way of doing things
  (setq exwm-input-global-keys
        `(
          ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
          ;; ([?\M-r] . exwm-reset)

	  ;; System managment related
	  ([?\s-q] . (lambda (command) (interactive (shell-command "killall X"))))
	  ([?\s-x] . (lambda (command) (interactive (shell-command "~/.scripts/dmenu_action.sh"))))
	  ([?\s-s] . (lambda (command) (interactive (shell-command "flameshot gui"))))
	  ;; ([?\s-f] . (lambda (command) (interactive (shell-command "flameshot gui")))) exwm

          ;; Program managment
          ([?\s-r] . (lambda (command)
                       (interactive (list (read-shell-command "$ ")))
                       (start-process-shell-command command nil command)))
	  ;;([?\s-d] . (start-process "dmenu" nil "/usr/local/bin/dmenu_run" "-vi"))
	  ;; use start process somehow
	  ([?\s-d] . (lambda (command) (interactive (shell-command "~/.scripts/dmenu_run_history.sh"))))

          ;; Window managment
          ([?\s-h] . evil-window-left)
          ([?\s-l] . evil-window-right)
          ([?\s-k] . evil-window-up)
          ([?\s-j] . evil-window-down)
          ([?\s--] . evil-window-split)
          ([?\s-\\] . evil-window-vsplit)
          ([?\s-c] . evil-window-delete)

	  ;; Buffer managment
          ([?\s-b] . switch-to-buffer)
          ([?\s-C] . kill-current-buffer)

	  ;; Layout managment
	  ;; please get this done so i dont have problems
          ;; Workspace managment
          ;; ([?\M-w] . exwm-workspace-switch)
          ([?\M-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))

          ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
          ,@(mapcar (lambda (i)
                      `(,(kbd (format "s-%d" i)) .
                        (lambda ()
                          (interactive)
                          (exwm-workspace-switch-create ,i))))
                    (number-sequence 0 9))))
)
  ;;(exwm-enable))

EXWM-MODELINE

(use-package exwm-modeline)

MODE LINE STATUS

;; Show battery status in the mode line
(add-hook 'exwm-init-hook 'display-battery-mode)

;; Show the time and date in modeline
(setq display-time-day-and-date t)
(add-hook 'exwm-init-hook 'display-time-mode)
;; Also take a look at display-time-format and format-time-string

(add-hook 'exwm-init-hook 'exwm-modeline-mode)

ANKI-EDITOR

(use-package anki-editor)

REALGUD

;;(use-package realgud)

SMARTPARENS

;; (use-package
;;  smartparens
;;  :ensure t
;;  :defer t
;;  :hook (prog-mode eglot org-mode latex-mode)
;;  :config (require 'smartparens-config))

MODALKA

(use-package modalka)

DAP-MODE

(use-package dap-mode)

DESKTOP-SAVE

Desktop Save Mode is a feature to save the state of Emacs from one session to another.

;;(require 'desktop)
;;(desktop-save-mode t)
;;(setq desktop-auto-save-timeout 180)

EAT

eat is way better than vterm imo, eat line mode is for pasting

(use-package eat)

ELLAMA

(use-package ellama
  :ensure t
  :bind ("C-c e" . ellama-transient-main-menu)
  ;; send last message in chat buffer with C-c C-c
  :hook (org-ctrl-c-ctrl-c-final . ellama-chat-send-last-message)
  :init (setopt ellama-auto-scroll t)
  :config
  ;; show ellama context in header line in all buffers
  (ellama-context-header-line-global-mode +1))

ERC

ERC is a powerful, modular, and extensible Internet Relay Chat client distributed with GNU Emacs.

(require 'erc)
(add-hook 'erc-mode 'erc-autojoin-mode)

(setq
 erc-server '(("irc.libera.chat" "irc.oftc.net"))
 erc-nick "JuvenilePrinceps"
 erc-user-full-name "Emacs User"
 erc-default-port "6697"
 erc-track-shorten-start 8 ;; minmum number of characters for a channel name in the modeline
 erc-autojoin-channels-alist '(("irc.libera.chat" "#gentoo" "#emacs" "#gnu" "#bitcoin" "#linux" "#sysadmin" "#uncyclopedia" "#lisp"))
 erc-kill-buffer-on-part t ;; kills buffer when you run the part (leave channel) command
 erc-auto-query 'bury) ;; create a query buffer every time you recieve a private message

(setq
 erc-fill-column 120 ;; the column at which a paragraph is broken
 erc-fill-function 'erc-fill-static
 erc-fill-static-center 20)

(setq
 erc-track-exclude '("#windows")
 erc-track-exclude-types '("JOIN" "NICK" "QUIT" "MODE" "AWAY") ;; list of messages to be ignored
 erc-hide-list '("JOIN" "NICK" "QUIT" "MODE" "AWAY") ;; message types to hide
 erc-track-exclude-server-buffer t)

(setq erc-track-visibility nil) ;; Only use the current frame for visibility

;; Tracking specific keywords or people
;; (setq erc-pals '("shom_" "masteroman" "benoitj")
;;             erc-fools '("daviwil-test")
;;             erc-keywords '("guix" "wiki"))

;; Desktop notifications for matches/mentions
(add-to-list 'erc-modules 'notifications)

;; Check spelling of messages
;; (add-to-list 'erc-modules 'spelling)

;; List active user's nicks in a side window 
(add-to-list 'erc-modules 'nickbar)

;; Uniquely colorize nicknames in chat
(add-to-list 'erc-modules 'nicks)

;; Displaying inline images
;;(use-package erc-image
;;  :ensure t
;;  :after erc
;;  :config
;;  (setq erc-image-inline-rescale 300)
;;  (add-to-list 'erc-modules 'image))

;;(setq erc-track-enable-keybindings t)

(setq erc-prompt-for-password nil)

elisp-autofmt

(use-package elisp-autofmt
     :config 
     (setq elisp-autofmt-python-bin "/usr/bin/python3.13"))

GOD MODE

;;(use-package god-mode)
;;(use-package boon)

MULE

;;(use-package mule)

NEOTREE

Neotree is a file tree viewer. When you open neotree, it jumps to the current file thanks to neo-smart-open. The neo-window-fixed-size setting makes the neotree width be adjustable. NeoTree provides following themes: classic, ascii, arrow, icons, and nerd. Theme can be config’d by setting “two” themes for neo-theme: one for the GUI and one for the terminal. I like to use ‘SPC t’ for ‘toggle’ keybindings, so I have used ‘SPC t n’ for toggle-neotree.

COMMANDDESCRIPTIONKEYBINDING
neotree-toggleToggle neotreeSPC t n
neotree- dirOpen directory in neotreeSPC d n

C-c options

neotree file manipulation commands here

(use-package neotree
  :config
  (setq neo-smart-open t
        neo-theme "ascii"
        neo-show-hidden-files t
        neo-window-width 28
        neo-window-fixed-size nil
        inhibit-compacting-font-caches t)
        ;;projectile-switch-project-action 'neotree-projectile-action) 
        ;; truncate long file names in neotree
        (add-hook 'neo-after-create-hook
           #'(lambda (_)
               (with-current-buffer (get-buffer neo-buffer-name)
                 (setq truncate-lines t)
                 (setq word-wrap nil)
                 (make-local-variable 'auto-hscroll-mode)
                 (setq auto-hscroll-mode nil)))))

About

This is my emacs config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published