I don't use Vim, wild right?

Weirdly, I don't use Catppuccin for my Emacs colour-scheme, instead I use Doom's version of Tokyo-Night

Anyway, my config files, put here mostly for me if I am being honest, so that I can easily setup a new system from scratch without that much effort

First, the init.el and packages.el files:

init.el:

(doom!
       :completion
       ;;company           ; the ultimate code completion backend
       (corfu +orderless +dabbrev +info +history +indexed +echo +cape)  ; complete with cap(f), cape and a flying feather!
       ;;helm              ; the *other* search engine for love and life
       ;;ido               ; the other *other* search engine...
       (ivy +childframe +prescient +icons)               ; a search engine for love and life
       ;;vertico           ; the search engine of the future

       :ui
       ;;deft              ; notational velocity for Emacs
       doom              ; what makes DOOM look the way it does
       doom-dashboard    ; a nifty splash screen for Emacs
       ;;doom-quit         ; DOOM quit-message prompts when you quit Emacs
       ;;(emoji +unicode)  ; 🙂
       hl-todo           ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
       ;;indent-guides     ; highlighted indent columns
       ;;ligatures         ; ligatures and symbols to make your code pretty again
       ;;minimap           ; show a map of the code on the side
       modeline          ; snazzy, Atom-inspired modeline, plus API
       ;;nav-flash         ; blink cursor line after big motions
       ;;neotree           ; a project drawer, like NERDTree for vim
       ophints           ; highlight the region an operation acts on
       (popup +defaults)   ; tame sudden yet inevitable temporary windows
       (tabs +centaur-tabs)              ; a tab bar for Emacs
       treemacs          ; a project drawer, like neotree but cooler
       ;;unicode           ; extended unicode support for various languages
       (vc-gutter +pretty) ; vcs diff in the fringe
       vi-tilde-fringe   ; fringe tildes to mark beyond EOB
       (window-select +switch-window)     ; visually switch windows
       workspaces        ; tab emulation, persistence & separate workspaces
       ;;zen               ; distraction-free coding or writing

       :editor
       ;;(evil +everywhere); come to the dark side, we have cookies
       file-templates    ; auto-snippets for empty files
       fold              ; (nigh) universal code folding
       ;;(format +onsave)  ; automated prettiness
       ;;god               ; run Emacs commands without modifier keys
       ;;lispy             ; vim for lisp, for people who don't like vim
       multiple-cursors  ; editing in many places at once
       ;;rotate-text       ; cycle region at point between text candidates
       snippets          ; my elves. They type so I don't have to
       ;;word-wrap         ; soft wrapping with language-aware indent

       :emacs
       dired             ; making dired pretty [functional]
       electric          ; smarter, keyword-based electric-indent
       ;;eww               ; the internet is gross
       ;;ibuffer           ; interactive buffer management
       undo              ; persistent, smarter undo for your inevitable mistakes
       vc                ; version-control and Emacs, sitting in a tree

       :term
       ;;term              ; basic terminal emulator for Emacs
       vterm             ; the best terminal emulation in Emacs

       :checkers
       syntax              ; tasing you for every semicolon you forget
       ;;(spell +flyspell) ; tasing you for misspelling mispelling
       ;;grammar           ; tasing grammar mistake every you make

       :tools
       ;;collab            ; buffers with friends
       debugger          ; FIXME stepping through code, to help you add bugs
       ;;direnv
       (eval +overlay)     ; run code, run (also, repls)
       lookup              ; navigate your code and its documentation
       lsp               ; M-x vscode
       magit             ; a git porcelain for Emacs
       ;;make              ; run make tasks from Emacs


       :os
       ;;(:if (featurep :system 'macos) macos)  ; improve compatibility with macOS
       tty               ; improve the terminal Emacs experience

       :lang
       ;;agda              ; types of types of types of types...
       ;;beancount         ; mind the GAAP
       (cc +lsp)         ; C > C++ == 1
       ;;clojure           ; java with a lisp
       ;;elm               ; care for a cup of TEA?
       (emacs-lisp +lsp)        ; drown in parentheses
       ;;erlang            ; an elegant language for a more civilized age
       (go +lsp)         ; the hipster dialect
       (graphql +lsp)    ; Give queries a REST
       ;;(haskell +lsp)    ; a language that's lazier than I am
       ;;hy                ; readability of scheme w/ speed of python
       ;;idris             ; a language you can depend on
       ;;json              ; At least it ain't XML
       (java +lsp)       ; the poster child for carpal tunnel syndrome
       (javascript +lsp)        ; all(hope(abandon(ye(who(enter(here))))))
       ;;julia             ; a better, faster MATLAB
       ;;lua               ; one-based indices? one-based indices
       markdown          ; writing docs for people to ignore
       ;;nim               ; python + lisp at the speed of c
       ;;nix               ; I hereby declare "nix geht mehr!"
       ;;ocaml             ; an objective camel
       org               ; organize your plain life in plain text
       ;;php               ; perl's insecure younger brother
       ;;plantuml          ; diagrams for confusing people more
       ;;graphviz          ; diagrams for confusing yourself even more
       ;;purescript        ; javascript, but functional
       (python +lsp)            ; beautiful is better than ugly
       (web +lsp)               ; the tubes

       (default +bindings +smartparens))

(setq package-native-compile t)
;; Set garbage collection threshold to 1GB.
(setq gc-cons-threshold (* 2048 1024 750))
(setq read-process-output-max (* 2048 2048)) ;; 1mb

packages.el:

(package! corfu-terminal)
(package! nerd-icons-corfu)

 (package! corfu-doc-terminal
   :recipe   (:type git
   :repo "https://codeberg.org/akib/emacs-corfu-doc-terminal.git"))
(package! ace-jump-mode)
(package! rainbow-mode)
(package! avy)
(package! visual-regexp-steroids)
(package! clipetty)
(package! comment-dwim-2)
(package! lsp-pyright)

... and now, for the one y'all actually came for:

config.el:

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!



(setq doom-theme 'doom-tokyo-night)


(setq display-line-numbers-type t)


(setq org-directory "~/org/")

;; Corfu


(corfu-echo-mode +1)
(corfu-history-mode +1)

(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)

;; (add-hook 'corfu-mode-hook #'corfu-doc-mode)
;; Optionally:
(setq nerd-icons-corfu-mapping
      '((array :style "cod" :icon "symbol_array" :face font-lock-type-face)
        (boolean :style "cod" :icon "symbol_boolean" :face font-lock-builtin-face)
        ;; ...
        (t :style "cod" :icon "code" :face font-lock-warning-face)))
        ;; Remember to add an entry for `t', the library uses that as default.

;; The Custom interface is also supported for tuning the variable above.
(setq kill-whole-line t)
(setq user-full-name "Seb REDACATED"    ;Really hope I remember to like,
                                        ;update these when I copy this into my setup lmao
      user-mail-address "niceTry@sucker.thisisntaTLD")
(setq auto-save-default t
      make-backup-files t)
(setq confirm-kill-emacs nil)
(setq doom-font (font-spec :family "CodeNewRoman Nerd Font Mono" :size 14)
      doom-variable-pitch-font (font-spec :family "CodeNewRoman Nerd Font Mono" :size 14))
(custom-set-faces!
  '(doom-dashboard-banner :inherit default)
  '(doom-dashboard-loaded :inherit default))


(use-package! visual-regexp-steroids
  :defer 3
  :config
  ;; (require 'pcre2el)
  ;; (setq vr/engine 'pcre2el)
  (map! "C-c s r" #'vr/replace)
  (map! "C-c s q" #'vr/query-replace))

(after! undo-fu
  (map! :map undo-fu-mode-map "M-/" #'undo-fu-only-redo))

(after! treemacs
  (treemacs-follow-mode 1))
(unless window-system
  (xterm-mouse-mode)
  (global-set-key (kbd "<mouse-4>") 'scroll-down-line)
  (global-set-key (kbd "<mouse-5>") 'scroll-up-line))
;; (global-clipetty-mode)
(map! "C-s" #'+default/search-buffer
      "C-t" #'eshell-toggle
      )

;; (map! "C-<tab>" #'format/region
(map! "<backtab>" #'indent-rigidly-left-to-tab-stop
      )

(use-package! eshell-follow
  :after-call eshell-follow-global-mode)


(defadvice kill-ring-save (before slick-copy activate compile)
  "When called interactively with no active region, copy a single line instead."
  (interactive
   (if mark-active
       (list (region-beginning) (region-end))
     (message "Copied line")
     (list (line-beginning-position) (line-beginning-position 2)))))

(defadvice kill-ring-save (after keep-transient-mark-active ()) ;
  "Override the deactivation of the mark."
  (setq deactivate-mark nil))
(ad-activate 'kill-ring-save)

(defun mark-unmark-toggle()             ;does what it says on the box ~~fuck this took me way too long lmao~~
  (interactive
   (if mark-active
       (deactivate-mark)
     (push-mark nil nil t))))

(defadvice backward-kill-word (around delete-pair activate)
  (if (eq (char-syntax (char-before)) ?\()
      (progn
    (backward-char 1)
    (save-excursion
      (forward-sexp 1)
      (delete-char -1))
    (forward-char 1)
    (append-next-kill)
    (kill-backward-chars 1))
    ad-do-it))

(defun acg/with-mark-active (&rest args)
  "Keep mark active after command. To be used as advice AFTER any
function that sets `deactivate-mark' to t."
  (setq deactivate-mark nil))

(advice-add 'comment-or-uncomment-region :after #'acg/with-mark-active)

(setq cd2/region-command 'cd2/comment-or-uncomment-lines)

(map! "M-#" #'comment-dwim-2)
(map! "C-@" #'mark-unmark-toggle)
(map! "C-SPC" #'mark-unmark-toggle)

(defun kill-line-or-region ()
  "kill region if active only or kill line normally"
  (interactive)
  (if (region-active-p)
      (call-interactively 'kill-region)
    (call-interactively 'kill-line)))

(global-set-key (kbd "C-k") 'kill-line-or-region)

;; (map! "C-w" #'backward-kill-word)
(defun backward-kill-region-or-word ()
  "kill region if active only or kill line normally"
  (interactive)
  (if (region-active-p)
      (call-interactively 'kill-region)
    (call-interactively 'backward-kill-word)))
(global-set-key (kbd "C-w") 'backward-kill-region-or-word)


(autoload
  'ace-jump-mode
  "ace-jump-mode"
  "Emacs quick move minor mode"
  t)
;; you can select the key you prefer to
(map! "C-c C-t" #'treemacs-select-window)
  ;; config.el
  ;; (require 'tera-mode)
;; (treemacs-no-png-images t)
(setq doom-themes-treemacs-theme "doom-colors")
(setq treemacs-no-png-images t)


(global-set-key (kbd "C-x C-t") 'ivy-switch-buffer-other-window)
(global-set-key (kbd "C-<tab>") '+ivy/switch-workspace-buffer)

(setq persp-emacsclient-init-frame-behaviour-override "main")

(global-set-key (kbd "C-c SPC") 'avy-goto-char)
(global-set-key (kbd "C-c C-SPC") 'avy-goto-char)

(defun copy-to-clipboard ()
  (interactive)
  (if (display-graphic-p)
      (progn
        (message "Yanked region to x-clipboard!")
        (call-interactively 'clipboard-kill-ring-save)
        )
    (if (region-active-p)
        (progn
          (shell-command-on-region (region-beginning) (region-end) "xsel -i -b")
          (message "Yanked region to clipboard!")
          (deactivate-mark))
      (message "No region active; can't yank to clipboard!")))
  )

(defun paste-from-clipboard ()
  (interactive)
  (if (display-graphic-p)
      (progn
        (clipboard-yank)
        (message "graphics active")
        )
    (insert (shell-command-to-string "xsel -o -b"))
    )
  )


(if (display-graphic-p)
    (progn
      ;; if graphic
      (use-package! corfu
        :custom
        (corfu-auto t)               ;; Enable auto completion
        (corfu-preselect 'directory) ;; Select the first candidate, except for directories

        :init
        (global-corfu-mode)

        :config
        ;; Free the RET key for less intrusive behavior.
        ;; Option 1: Unbind RET completely
        ;; (keymap-unset corfu-map "RET")
        ;; Option 2: Use RET only in shell modes
        (keymap-set corfu-map "RET" `( menu-item "" nil :filter
                                       ,(lambda (&optional _)
                                          (and (derived-mode-p 'eshell-mode 'comint-mode)
                                               #'corfu-send))))))

  ;; else (optional)
  (use-package! corfu
    :custom
    (corfu-auto t)               ;; Enable auto completion
    (corfu-preselect 'directory)) ;; Select the first candidate, except for directories
  (after! corfu
    (map! :map corfu-map
          "TAB"     #'corfu-insert))
  (keymap-unset corfu-map "RET")
    (corfu-terminal-mode +1))



(custom-set-faces!
  '(default :background nil))



(after! lsp-volar
  ;; remove :system after lsp-volar loaded
  (lsp-dependency 'typescript
                  '(:npm :package "typescript"
                    :path "tsserver")))
;; Garbage collection (or lack thereof soon)
(defmacro k-time (&rest body)
  "Measure and return the time it takes evaluating BODY."
  `(let ((time (current-time)))
     ,@body
     (float-time (time-since time))))


;; When idle for 15sec run the GC no matter what.
(defvar k-gc-timer
  (run-with-idle-timer 15 t
                       (lambda ()
                         (message "Garbage Collector has run for %.06fsec"
                                  (k-time (garbage-collect))))))