diff --git a/.config/emacs/config.org b/.config/emacs/config.org deleted file mode 100644 index 6809ae5..0000000 --- a/.config/emacs/config.org +++ /dev/null @@ -1,1089 +0,0 @@ -#+TITLE: Crony's Emacs Config -#+AUTHOR: Crony Akatsuki -#+DESCRIPTION: Crony's personal emacs config -#+STARTUP: showeverything -#+OPTIONS: toc:2 -#+PROPERTY: header-args:emacs-lisp :tangle ./init.el - -* TABLE OF CONTENTS :toc: -- [[#garbage-collection][GARBAGE COLLECTION]] -- [[#loading-custom-scripts][LOADING CUSTOM SCRIPTS]] -- [[#backups][BACKUPS]] -- [[#sane-defaults][SANE DEFAULTS]] -- [[#gui-tweaks][GUI TWEAKS]] -- [[#electric-pair][ELECTRIC PAIR]] -- [[#fonts][FONTS]] -- [[#package-manager][PACKAGE MANAGER]] -- [[#general-keybindings][GENERAL KEYBINDINGS]] -- [[#diminish][DIMINISH]] -- [[#org-mode][ORG MODE]] - - [[#update-and-setup-org-mode][Update and setup org mode]] - - [[#column-width][Column width]] - - [[#enabling-org-bullets][Enabling Org Bullets]] - - [[#enabling-table-of-contents][Enabling Table of Contents]] - - [[#auto-tangle-emacs-configuration][Auto-tangle emacs configuration]] -- [[#evil-mode][EVIL MODE]] -- [[#hydra][HYDRA]] -- [[#catppuccin-color-theme][CATPPUCCIN COLOR THEME]] -- [[#all-the-icons][ALL THE ICONS]] -- [[#helpful][HELPFUL]] -- [[#completion][COMPLETION]] - - [[#vertico][Vertico]] - - [[#marginalia][Marginalia]] - - [[#consult][Consult]] - - [[#orderless][Orderless]] -- [[#language-support][LANGUAGE SUPPORT]] - - [[#adittional-modes][Adittional mode's]] - - [[#lsp-mode][lsp-mode]] - - [[#commenting][Commenting]] -- [[#code-completion][CODE COMPLETION]] - - [[#corfu][Corfu]] - - [[#kind-icon][Kind icon]] - - [[#cape][Cape]] - - [[#yasnippet][Yasnippet]] -- [[#flycheck][FLYCHECK]] - - [[#general-setup][General setup]] - - [[#python][Python]] -- [[#dashboard][DASHBOARD]] -- [[#dired][DIRED]] -- [[#git-programs][GIT PROGRAMS]] - - [[#git-time-machine][Git Time Machine]] - - [[#git-gutter][Git gutter]] - - [[#magit][Magit]] -- [[#highlight-todo][HIGHLIGHT TODO]] -- [[#modeline][MODELINE]] -- [[#projectile][PROJECTILE]] -- [[#rainbow-delimiters][RAINBOW DELIMITERS]] -- [[#rainbow-mode][RAINBOW MODE]] -- [[#shells-and-terminals][SHELLS AND TERMINALS]] - - [[#eshell][Eshell]] - - [[#vterm][Vterm]] - - [[#vterm-toggle][Vterm-toggle]] -- [[#sudo-edit][SUDO EDIT]] -- [[#transparency][TRANSPARENCY]] -- [[#treesitter][TREESITTER]] -- [[#vim-like-scroll][VIM LIKE SCROLL]] -- [[#which_key][WHICH_KEY]] - -* GARBAGE COLLECTION - -#+begin_src emacs-lisp -(defvar file-name-handler-alist-old file-name-handler-alist) - -(setq file-name-handler-alist nil - gc-cons-threshold most-positive-fixnum) - -(add-hook 'after-init-hook - `(lambda () - (setq file-name-handler-alist file-name-handler-alist-old) - (setq gc-cons-threshold (* 2 1000 1000)) - (setq gc-cons-percentage 0.1)) - t) -#+end_src - -* LOADING CUSTOM SCRIPTS - -#+begin_src emacs-lisp -(add-to-list 'load-path "~/.config/emacs/scripts/") -#+end_src - -* BACKUPS - -Move backup files to a diff directory. - -#+begin_src emacs-lisp -(setq backup-directory-alist '(("." . "~/.cache/emacs/")) - backup-by-copying t ; Don't delink hardlinks - version-control t ; Use version numbers on backups - delete-old-versions t ; Automatically delete excess backups - kept-new-versions 20 ; how many of the newest versions to keep - kept-old-versions 5 ; and how many of the old - ) -#+end_src - -* SANE DEFAULTS - -#+begin_src emacs-lisp -(delete-selection-mode 1) ;; You can select text and delete it by typing. -(electric-indent-mode -1) ;; Turn off the weird indenting that Emacs does by default. -(global-auto-revert-mode t) ;; Automatically show changes if the file has changed -(setq initial-scratch-message nil) ;; disable the initial scratch message. -(setq-default delete-pair-blink-delay 0) ;; remove delay when deleting pairs -(prefer-coding-system 'utf-8) ;; utf-8 -(global-set-key [escape] 'keyboard-escape-quit) ;; escape minibuffers with ESC -#+end_src - -* GUI TWEAKS - -#+begin_src emacs-lisp -(global-visual-line-mode t) ;; Enable truncated lines -(menu-bar-mode -1) ;; Disable the menu bar -(scroll-bar-mode -1) ;; Disable the scroll bar -(tool-bar-mode -1) ;; Disable the tool bar -(set-fringe-mode 10) ;; Give me some breathing room -(fset 'yes-or-no-p 'y-or-n-p) ;; don't ask to spell out "yes" -(setq-default frame-resize-pixelwise t) ;; avoid leaving a gap beetween the frame and the screen -(column-number-mode) ;; Display line colums -;; disable line numbers for following modes -(dolist (mode '(org-mode-hook - term-mode-hook - shell-mode-hook - eshell-mode-hook)) - (add-hook mode (lambda () (display-line-numbers-mode 0)))) -(global-display-line-numbers-mode 1) ;; Display line numbers -(blink-cursor-mode -1) ;; disable blinking cursor -#+end_src - -* ELECTRIC PAIR - -#+begin_src emacs-lisp -(electric-pair-mode 1) -(add-hook 'org-mode-hook (lambda () - (setq-local electric-pair-inhibit-predicate - `(lambda (c) - (if (char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))) -#+end_src - -* FONTS - -#+begin_src emacs-lisp -(set-face-attribute 'default nil - :font "CaskaydiaCove Nerd Font" - :height 110 - :weight 'medium) -(set-face-attribute 'variable-pitch nil - :font "CaskaydiaCove Nerd Font" - :height 120 - :weight 'medium) -(set-face-attribute 'fixed-pitch nil - :font "CaskaydiaCove Nerd Font" - :height 110 - :weight 'medium) - -(add-to-list 'default-frame-alist '(font . "CaskaydiaCove Nerd Font-11")) -#+end_src - -* PACKAGE MANAGER - -#+begin_src emacs-lisp -(require 'elpaca-setup) - -;; make sure packages are always installed -(setq use-package-always-ensure t) -#+end_src - -* GENERAL KEYBINDINGS - -#+begin_src emacs-lisp -(use-package general - :config - (general-evil-setup) - - (general-create-definer crony/leader-keys - :states '(normal insert visual emacs) - :keymaps 'override - :prefix "SPC" - :global-prefix "M-SPC") - - (crony/leader-keys - "SPC" '(execute-extended-command :wk "M-x")) - - (crony/leader-keys - "b" '(:ignore t :wk "Bookmarks/Buffers") - "b c" '(clone-indirect-buffer :wk "Create indirect buffer copy in a split") - "b C" '(clone-indirect-buffer-other-window :wk "Clone indirect buffer in new window") - "b d" '(bookmark-delete :wk "Delete bookmark") - "b i" '(consult-buffer :wk "Change Buffer") - "b k" '(kill-this-buffer :wk "Kill this buffer") - "b K" '(kill-some-buffers :wk "Kill multiple buffers") - "b l" '(list-bookmarks :wk "List bookmarks") - "b m" '(bookmark-set :wk "Set bookmark") - "b n" '(next-buffer :wk "Next buffer") - "b p" '(previous-buffer :wk "Previous buffer") - "b r" '(revert-buffer :wk "Reload buffer") - "b R" '(rename-buffer :wk "Rename buffer") - "b s" '(basic-save-buffer :wk "Save buffer") - "b S" '(save-some-buffers :wk "Save multiple buffers") - "b w" '(bookmark-save :wk "Save current bookmarks to bookmark file")) - - (crony/leader-keys - "d" '(:ignore t :wk "Dired") - "d d" '(dired :wk "Open dired") - "d j" '(dired-jump :wk "Dired jump to current") - "d p" '(peep-dired :wk "Peep dired")) - - (crony/leader-keys - "e" '(:ignore t :wk "Eshell/Evaluate") - "e b" '(eval-buffer :wk "Evaluate elisp in buffer") - "e d" '(eval-defun :wk "Evaluate defun containing or after point") - "e e" '(evalexpression :wk "Evaluate elisp expression") - "e h" '(consult-history :wk "Eshell History") - "e l" '(eval-last-sexp :wk "Evaluate elisp expression before point") - "e r" '(eval-region :wk "Evaluate elisp in region") - "e s" '(eshell :wk "Eshell")) - - (crony/leader-keys - "f" '(:ignore t :wk "Files") - "f f" '(find-file :wk "Find File") - "f c" '((lambda () (interactive) - (find-file "~/.config/emacs/config.org")) - :wk "Open emacs config.org") - "f e" '((lambda () (interactive) - (dired "~/.config/emacs/")) - :wk "Open user-emacs-directory in dired") - "f w" '(consult-grep :wk "Search for string current files in dir")) - - (crony/leader-keys - "g" '(:ignore t :wk "Git") - "g /" '(magit-displatch :wk "Magit dispatch") - "g ." '(magit-file-displatch :wk "Magit file dispatch") - "g b" '(magit-branch-checkout :wk "Switch branch") - "g c" '(:ignore t :wk "Create") - "g c b" '(magit-branch-and-checkout :wk "Create branch and checkout") - "g c c" '(magit-commit-create :wk "Create commit") - "g c f" '(magit-commit-fixup :wk "Create fixup commit") - "g C" '(magit-clone :wk "Clone repo") - "g f" '(:ignore t :wk "Find") - "g f c" '(magit-show-commit :wk "Show commit") - "g f f" '(magit-find-file :wk "Magit find file") - "g f g" '(magit-find-git-config-file :wk "Find gitconfig file") - "g F" '(magit-fetch :wk "Git fetch") - "g g" '(magit-status :wk "Magit status") - "g i" '(magit-init :wk "Initialize git repo") - "g l" '(magit-log-buffer-file :wk "Magit buffer log") - "g r" '(vc-revert :wk "Git revert file") - "g s" '(magit-stage-file :wk "Git stage file") - "g t" '(git-timemachine :wk "Git time machine") - "g u" '(magit-stage-file :wk "Git unstage file")) - - (crony/leader-keys - "h" '(:ignore t :wk "Help") - "h a" '(consult-man :wk "Apropos") - "h b" '(describe-bindings :wk "Describe bindings") - "h c" '(describe-char :wk "Describe character under cursor") - "h d" '(:ignore t :wk "Emacs documentation") - "h d a" '(about-emacs :wk "About Emacs") - "h d d" '(view-emacs-debugging :wk "View Emacs debugging") - "h d f" '(view-emacs-FAQ :wk "View Emacs FAQ") - "h d m" '(info-emacs-manual :wk "The Emacs manual") - "h d n" '(view-emacs-news :wk "View Emacs news") - "h d o" '(describe-distribution :wk "How to obtain Emacs") - "h d p" '(view-emacs-problems :wk "View Emacs problems") - "h d t" '(view-emacs-todo :wk "View Emacs todo") - "h d w" '(describe-no-warranty :wk "Describe no warranty") - "h e" '(view-echo-area-messages :wk "View echo area messages") - "h f" '(describe-function :wk "Describe function") - "h F" '(describe-face :wk "Describe face") - "h g" '(describe-gnu-project :wk "Describe GNU Project") - "h i" '(info :wk "Info") - "h I" '(describe-input-method :wk "Describe input method") - "h k" '(describe-key :wk "Describe key") - "h l" '(view-lossage :wk "Display recent keystrokes and the commands run") - "h L" '(describe-language-environment :wk "Describe language environment") - "h m" '(describe-mode :wk "Describe mode") - "h r" '(:ignore t :wk "Reload") - "h r r" '((lambda () (interactive) - (load-file "~/.config/emacs/init.el") - (ignore (elpaca-process-queues))) - :wk "Reload emacs config") - "h t" '(load-theme :wk "Load theme") - "h v" '(describe-variable :wk "Describe variable") - "h w" '(where-is :wk "Prints keybinding for command if set") - "h x" '(describe-command :wk "Display full documentation for command")) - - (crony/leader-keys - "o" '(:ignore t :wk "Org") - "o a" '(org-agenda :wk "Org Agenda") - "o e" '(org-export-dispatch :wk "Org Export Dispatch") - "o i" '(org-toggle-item :wk "Org Toggle Item") - "o l" '(org-insert-link :wk "Org Insert Link") - "o t" '(org-todo :wk "Org Todo") - "o B" '(org-babel-tangle :wk "Org Babel Tangle") - "o T" '(org-todo-list :wk "Org Todo List") - "o b" '(:ignore t :wk "Tables") - "o b -" '(org-table-insert-hline :wk "Insert hline in table") - "o d" '(:ignore t :wk "Date/Deadline") - "o d t" '(org-time-stamp :wk "Org Time Stamp")) - - (crony/leader-keys - "t" '(:ignore t :wk "Toggle") - "t l" '(display-line-numbers-mode :wk "Toggle Line Numbres") - "t t" '(visual-line-mode :wk "Toggle Truncated Lines") - "t v" '(vterm-toggle :wk "Toggle VTerm")) - - (crony/leader-keys - "w" '(:ignore t :wk "Windows") - ;; Window splits - "w c" '(evil-window-delete :wk "Close window") - "w n" '(evil-window-new :wk "New window") - "w s" '(evil-window-split :wk "Horizontal split window") - "w v" '(evil-window-vsplit :wk "Vertical split window") - ;; Window motions - "w h" '(evil-window-left :wk "Window left") - "w j" '(evil-window-down :wk "Window down") - "w k" '(evil-window-up :wk "Window up") - "w l" '(evil-window-right :wk "Window right") - "w w" '(evil-window-next :wk "Goto next window") - ;; Move Windows - "w H" '(buf-move-left :wk "Buffer move left") - "w J" '(buf-move-down :wk "Buffer move down") - "w K" '(buf-move-up :wk "Buffer move up") - "w L" '(buf-move-right :wk "Buffer move right")) -) -(elpaca-wait) -#+end_src - -* DIMINISH - -#+begin_src emacs-lisp -(use-package diminish) -(elpaca-wait) -#+end_src - -* ORG MODE - -** Update and setup org mode - -#+begin_src emacs-lisp - -;; fixes a bug where evil mnode bounds return key, so it isn't accesible -(with-eval-after-load 'evil-maps - (define-key evil-motion-state-map (kbd "RET") nil)) - -(defun crony/org-mode-setup () - (org-indent-mode) - (visual-line-mode 1)) - -;; Replace list hyphen with dot -(font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) - -(use-package org - :defer t - :init (require 'org-tempo) - :hook (org-mode . crony/org-mode-setup) - :config - (setq org-ellipsis " ▾") - (setq org-edit-src-content-indentation 0) - - ;; org agenda settings - (setq org-agenda-start-with-log-mode t) - (setq org-log-done 'time) - (setq org-log-into-drawer t) - (setq org-agenda-files - '("~/docs/notes/tasks.org" - "~/docs/notes/birthdays.org")) - - ;; refiling - (setq org-refile-targets - '(("archive.org" :maxlevel . 1) - ("tasks.org" :maxlevel . 1))) - - ;; save after refiling - (advice-add 'org-refile :after 'org-save-all-org-buffers) - - (setq org-return-follows-link t)) -#+end_src - -** Column width - -#+begin_src emacs-lisp -(defun crony/org-mode-visual-fill () - (setq visual-fill-column-width 110 - visual-fill-column-center-text t) - (visual-fill-column-mode 1)) - -(use-package visual-fill-column - :defer t - :hook (org-mode . crony/org-mode-visual-fill)) -#+end_src - -** Enabling Org Bullets - -#+begin_src emacs-lisp -(use-package org-bullets - :after org - :hook (org-mode . org-bullets-mode)) -#+end_src - -** Enabling Table of Contents - -#+begin_src emacs-lisp -(use-package toc-org - :after org - :commands toc-org-enable - :init (add-hook 'org-mode-hook 'toc-org-enable)) -#+end_src - -** Auto-tangle emacs configuration - -#+begin_src emacs-lisp -(defun crony/org-babel-tangle-config () - (when (string-equal (buffer-file-name) - (expand-file-name "~/.config/emacs/config.org")) - ;; Dynamic scoping to the rescue - (let ((org-confirm-babel-evaluate nil)) - (org-babel-tangle)))) - -(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'crony/org-babel-tangle-config))) -#+end_src - -* EVIL MODE - -#+begin_src emacs-lisp -(use-package evil - :init - (setq evil-want-integration t - evil-want-keybinding nil - evil-want-C-u-scroll t - evil-want-C-i-jump nil - evil-vsplit-window-right t - evil-split-window-below t - evil-undo-system 'undo-redo) - :config - (evil-mode 1) - (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) - (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) - (evil-set-initial-state 'messages-buffer-mode 'normal) - (evil-set-initial-state 'dashboard-mode 'normal)) - -(use-package evil-collection - :after evil - :config - (evil-collection-init)) -#+end_src - -* HYDRA - -#+begin_src emacs-lisp -(use-package hydra - :config - (defhydra hydra-text-scale (:timeout 4) - "scale text" - ("j" text-scale-increase "in") - ("k" text-scale-decrease "out") - ("f" nil "finished" :exit t)) - - (crony/leader-keys - "ts" '(hydra-text-scale/body :wk "scale text"))) -#+end_src - -* CATPPUCCIN COLOR THEME - -#+begin_src emacs-lisp -(use-package catppuccin-theme - :ensure t - :init - (setq catppuccin-flavor 'frappe) - :config - (catppuccin-reload) - (load-theme 'catppuccin :no-confirm) - ;; Makes commented text and keywords italics - (set-face-attribute 'font-lock-comment-face nil - :slant 'italic) - (set-face-attribute 'font-lock-keyword-face nil - :slant 'italic) -) -#+end_src - -* ALL THE ICONS - -#+begin_src emacs-lisp -(use-package all-the-icons - :ensure t - :if (display-graphic-p)) - -;; dired icons -(use-package all-the-icons-dired - :after all-the-icons - :hook (dired-mode . (lambda () (all-the-icons-dired-mode t)))) - -;; completion with marginalia -(use-package all-the-icons-completion - :after (marginalia all-the-icons) - :hook (marginalia-mode . all-the-icons-completion-marginalia-setup) - :init - (all-the-icons-completion-mode)) -#+end_src - -* HELPFUL - -#+begin_src emacs-lisp -(use-package helpful - :bind - ([remap describe-function] . helpful-function) - ([remap describe-command] . helpful-command) - ([remap describe-variable] . helpful-variable) - ([remap describe-key] . helpful-key)) -#+end_src - -* COMPLETION - -** Vertico - -#+begin_src emacs-lisp -(use-package vertico - :ensure t - :bind (:map vertico-map - ("C-j" . vertico-next) - ("C-k" . vertico-previous) - ("C-l" . vertico-exit) - :map minibuffer-local-map - ("C-h" . backward-kill-word)) - :custom - (vertico-count 15) - (vertico-resize t) - (vertico-cycle t) - :init - (vertico-mode) - -;; prefix candidate with right arrow -(defvar +vertico-current-arrow t) - -(cl-defmethod vertico--format-candidate :around - (cand prefix suffix index start &context ((and +vertico-current-arrow - (not (bound-and-true-p vertico-flat-mode))) - (eql t))) - (setq cand (cl-call-next-method cand prefix suffix index start)) - (if (bound-and-true-p vertico-grid-mode) - (if (= vertico--index index) - (concat #("▶ " 0 1 (face vertico-current)) cand) - (concat #("_ " 0 1 (display " ")) cand)) - (if (= vertico--index index) - (concat - #(" " 0 1 (display (left-fringe right-triangle vertico-current))) - cand) - cand))) -) - -(use-package savehist - :elpaca nil - :init - (savehist-mode)) - -(use-package emacs - :elpaca nil - :init - (defun crm-indicator (args) - (cons (format "[CRM%s] %s" - (replace-regexp-in-string - "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" - crm-separator) - (car args)) - (cdr args))) - (advice-add #'completing-read-multiple :filter-args #'crm-indicator) - (setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - (setq enable-recursive-minibuffers t)) -#+end_src - -** Marginalia - -#+begin_src emacs-lisp -(use-package marginalia - :after vertico - :ensure t - :custom - (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)) - :init - (marginalia-mode)) -#+end_src - -** Consult -#+begin_src emacs-lisp -(use-package consult - :after vertico - :custom - (completion-in-region-function #'consult-completion-in-region) - :config - (recentf-mode t)) -#+end_src - -** Orderless - -#+begin_src emacs-lisp -(use-package orderless - :init - (setq completion-styles '(orderless basic) - completion-category-defaults nil - completion-category-overrides '((file (styles partial-completion))))) -#+end_src - -* LANGUAGE SUPPORT - -** Adittional mode's -Additional package's for other languages. - -#+begin_src emacs-lisp -(use-package haskell-mode) ;; for haskell -(use-package lua-mode) ;; for lua - -(use-package pyvenv - :ensure t - :config - (pyvenv-mode 1)) -#+end_src - -** lsp-mode - -#+begin_src emacs-lisp -(use-package lsp-mode - :commands (lsp lsp-deferred) - :init - (setq lsp-keymap-prefix "SPC l") - :config - (lsp-enable-which-key-integration t) - (general-def 'normal lsp-mode :definer 'minor-mode - "SPC l" lsp-command-map)) -#+end_src - -*** python - -#+begin_src emacs-lisp -;; pyright support -(use-package lsp-pyright - :ensure t - :hook (python-mode . (lambda () - (require 'lsp-pyright) - (lsp))) - (python-ts-mode . (lambda () - (require 'lsp-pyright) - (lsp)))) -#+end_src - -*** lsp-ui - -#+begin_src emacs-lisp -(use-package lsp-ui - :hook (lsp-mode . lsp-ui-mode) - :custom - (lsp-ui-doc-position 'bottom)) -#+end_src - -*** consult - -#+begin_src emacs-lisp -(use-package consult-lsp - :after (lsp-mode) - :config - (define-key lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols)) -#+end_src - -** Commenting - -#+begin_src emacs-lisp -(use-package evil-nerd-commenter - :config - (crony/leader-keys - "TAB" '(evilnc-comment-or-uncomment-lines :wk "Comment or uncomment"))) -#+end_src - -* CODE COMPLETION - -** Corfu - -Auto completion in buffer on crack. - -#+begin_src emacs-lisp -(use-package corfu - ;; Optional customizations - :custom - ;; Works with `indent-for-tab-command'. Make sure tab doesn't indent when you - ;; want to perform completion - (tab-always-indent 'complete) - (completion-cycle-threshold nil) - (corfu-cycle t) - (corfu-auto t) - (corfu-auto-prefix 2) - (corfu-auto-delay 0.1) - (corfu-min-width 60) - (corfu-popupinfo-delay '(0.5 . 0.2)) - (corfu-preview-current 'insert) - (corfu-preselect 'prompt) - (corfu-on-exact-match nil) - - ;; Optionally use TAB for cycling, default is `corfu-complete'. - :bind (:map corfu-map - ("TAB" . corfu-next) - ([tab] . corfu-next) - ("S-TAB" . corfu-previous) - ([backtab] . corfu-previous) - ("S-" . corfu-insert) - ("RET" . corfu-insert)) - :init - (corfu-history-mode) - (corfu-popupinfo-mode) - (global-corfu-mode) - :config - (add-hook 'eshell-mode-hook - (lambda () (setq-local corfu-quit-at-boundary t - corfu-quit-no-match t - corfu-auto nil) - (corfu-mode)))) -#+end_src - -** Kind icon -Adding nice icons to corfu, just for the looks. -#+begin_src emacs-lisp -(use-package kind-icon - :ensure t - :after corfu - :custom - (kind-icon-default-face 'corfu-default) ; Have background color be the same as `corfu' face background - :config - ;; Fix icons to0 big making it so not all completion candidates show correctly - (plist-put kind-icon-default-style :height 0.8) - (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) ; Enable `kind-icon' -#+end_src - -** Cape -Extending corfu to be on crack^2 - -#+begin_src emacs-lisp -(use-package cape - :defer 10 - :bind ("C-c f" . cape-file) - :init - ;; Add `completion-at-point-functions', used by `completion-at-point'. - (defalias 'dabbrev-after-2 (cape-capf-prefix-length #'cape-dabbrev 2)) - (add-to-list 'completion-at-point-functions 'dabbrev-after-2 t) - (cl-pushnew #'cape-file completion-at-point-functions) - :config - ;; Silence then pcomplete capf, no errors or messages! - (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) - - ;; Ensure that pcomplete does not write to the buffer - ;; and behaves as a pure `completion-at-point-function'. - (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)) -#+end_src - -** Yasnippet -Adding in snippet support, for corfu on crack^3 - -#+begin_src emacs-lisp -(use-package yasnippet - :ensure t - :init - (setq yas-nippet-dir "~/.config/emacs/snippets/") - (yas-global-mode)) -(use-package yasnippet-snippets - :ensure t - :after yasnippet) -(use-package yasnippet-capf - :ensure nil - :after yasnippet - :hook ((prog-mode . yas-setup-capf) - (text-mode . yas-setup-capf) - (lsp-mode . yas-setup-capf) - (sly-mode . yas-setup-capf)) - :bind (("C-c y" . yasnippet-capf) - ("M-+" . yas-insert-snippet)) - :config - (defun yas-setup-capf () - (setq-local completion-at-point-functions - (cons 'yasnippet-capf - completion-at-point-functions))) - (push 'yasnippet-capf completion-at-point-functions)) -#+end_src - -* FLYCHECK - -** General setup - -#+begin_src emacs-lisp -(use-package flycheck - :ensure t - :defer t - :diminish - :config - (flycheck-add-next-checker 'python-pylint 'python-mypy) - :init (global-flycheck-mode) -) -#+end_src - -** Python - -#+begin_src emacs-lisp -;; mypy can't find implementation fix -(require 'mypy-python-executable) -;; use global pylint with virtual env's python executable -(setq-default flycheck-python-pylint-executable '"/usr/bin/pylint") -#+end_src - -* DASHBOARD -#+begin_src emacs-lisp -(use-package dashboard - :after org - :init - (setq initial-buffer-choice 'dashboard-open) - (setq dashboard-set-heading-icons t) - (setq dashboard-set-file-icons t) - (setq dashboard-banner-logo-title "Having fun with emacs!") - (setq dashboard-startup-banner "/home/crony/pics/troll-400x.png") - (setq dashboard-center-content t) - (setq dashboard-items '((recents . 5) - (agenda . 5) - (bookmarks . 3) - (projects . 3) - (registers . 3))) - :custom - (dashboard-modify-heading-icons '((recents . "file-text") - (bookmarks . "book"))) - :config - (dashboard-setup-startup-hook)) -#+end_src - -* DIRED - -#+begin_src emacs-lisp -(use-package dired-open - :config - (setq dired-open-extensions '(("gif" . "sxiv") - ("jpg" . "sxiv") - ("png" . "sxiv") - ("mkv" . "mpv") - ("mp4" . "mpv")))) - -(use-package peep-dired - :after dired - :hook (evil-normalize-keymaps . peep-dired-hook) - :config - (evil-define-key 'normal dired-mode-map (kbd "h") 'dired-up-directory) - (evil-define-key 'normal dired-mode-map (kbd "l") 'dired-open-file) - (evil-define-key 'normal peep-dired-mode-map (kbd "j") 'peep-dired-next-file) - (evil-define-key 'normal peep-dired-mode-map (kbd "k") 'peep-dired-prev-file) -) -#+end_src - -* GIT PROGRAMS -** Git Time Machine - -#+begin_src emacs-lisp -(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) -) -#+end_src - -** Git gutter - -#+begin_src emacs-lisp -(use-package git-gutter - :ensure t - :hook (prog-mode . git-gutter-mode) - :config - (setq git-gutter:update-interval 0.02)) - -(use-package git-gutter-fringe - :ensure t - :config - (define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated)) - (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated)) - (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom)) -#+end_src - -** Magit - -#+begin_src emacs-lisp -(use-package magit) -#+end_src - -* HIGHLIGHT TODO -Adding highlights to TODO and related words. - -#+begin_src emacs-lisp -(use-package hl-todo - :hook ((prog-mode . hl-todo-mode)) - :config - (setq hl-todo-highlight-punctuation ":" - hl-todo-keyword-faces - `(("TODO" warning bold) - ("FIXME" error bold) - ("HACK" font-lock-constant-face bold) - ("REVIEW" font-lock-keyword-face bold) - ("NOTE" success bold) - ("DEPRECATED" font-lock-doc-face bold)))) -#+end_src - -* MODELINE - -#+begin_src emacs-lisp -(use-package doom-modeline - :ensure t - :init (doom-modeline-mode 1) - :config - (setq doom-modeline-height 25 - doom-modeline-bar-width 5 - doom-modeline-persp-name t - doom-modeline-persp-icon t)) -#+end_src - -* PROJECTILE - -#+begin_src emacs-lisp -(use-package projectile - :diminish - :config - (projectile-mode 1) - (crony/leader-keys - "p" '(:ignore t :wk "Projectile") - "p p" '(projectile-switch-project :wk "Switch project") - "p f" '(projectile-find-file :wk "Find file in prroject") - "p u" '(projectile-run-project :wk "Run prroject") - "p P" '(projectile-test-project :wk "Test project"))) -#+end_src - -* RAINBOW DELIMITERS - -#+begin_src emacs-lisp -(use-package rainbow-delimiters - :hook (prog-mode . rainbow-delimiters-mode)) -#+end_src - -* RAINBOW MODE - -#+begin_src emacs-lisp -(use-package rainbow-mode - :diminish - :hook org-mode prog-mode) -#+end_src - -* SHELLS AND TERMINALS - -** Eshell -Eshell is an Emacs 'shell' that is written in Elisp. - -#+begin_src emacs-lisp -(use-package eshell-syntax-highlighting - :after esh-mode - :config - (eshell-syntax-highlighting-global-mode +1)) - -(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'("btop" "ssh" "zsh")) -#+end_src - -** Vterm -Vterm is a built in terminal emulator for emacs. - -#+begin_src emacs-lisp -(use-package vterm) -(setq shell-file-name "/bin/zsh" - vterm-max-scrollback 5000) -#+end_src - -** Vterm-toggle - -#+begin_src emacs-lisp -(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) - (reusable-frames . visible) - (window-height . 0.3)))) -#+end_src - -* SUDO EDIT - -sudo-edit gives us the ability to open files with sudo privileges. - -#+begin_src emacs-lisp -(use-package sudo-edit - :config - (crony/leader-keys - "f u" '(sudo-edit-find-file :wk "Sudo find file") - "f U" '(sudo-edit :wk "Sudo edit file"))) -#+end_src - -* TRANSPARENCY - -#+begin_src emacs-lisp -(add-to-list 'default-frame-alist '(alpha-background . 100)) -#+end_src - -* TREESITTER - -#+begin_src emacs-lisp -(setq treesit-language-source-alist - '((bash "https://github.com/tree-sitter/tree-sitter-bash") - (cmake "https://github.com/uyha/tree-sitter-cmake") - (css "https://github.com/tree-sitter/tree-sitter-css") - (elisp "https://github.com/Wilfred/tree-sitter-elisp") - (go "https://github.com/tree-sitter/tree-sitter-go") - (html "https://github.com/tree-sitter/tree-sitter-html") - (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src") - (dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile") - (json "https://github.com/tree-sitter/tree-sitter-json") - (make "https://github.com/alemuller/tree-sitter-make") - (markdown "https://github.com/ikatyang/tree-sitter-markdown") - (python "https://github.com/tree-sitter/tree-sitter-python") - (toml "https://github.com/tree-sitter/tree-sitter-toml") - (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") - (vue "https://github.com/ikatyang/tree-sitter-vue") - (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") - (yaml "https://github.com/ikatyang/tree-sitter-yaml") - (haskell "https://github.com/tree-sitter/tree-sitter-haskell") - (typst "https://github.com/uben0/tree-sitter-typst"))) - -(setq major-mode-remap-alist - '((yaml-mode . yaml-ts-mode) - (bash-mode . bash-ts-mode) - (js2-mode . js-ts-mode) - (javascript-mode . js-ts-mode) - (typescript-mode . typescript-ts-mode) - (json-mode . json-ts-mode) - (css-mode . css-ts-mode) - (python-mode . python-ts-mode) - (sh-mode . bash-ts-mode))) -#+end_src - -* VIM LIKE SCROLL - -#+begin_src emacs-lisp -;; Vim like scrolling -(setq scroll-margin 10 - scroll-step 1 - scroll-conservatively 10000 - scroll-preserve-screen-position 1) -#+end_src - -* WHICH_KEY - -#+begin_src emacs-lisp -(use-package which-key - :init - (which-key-mode 1) - :diminish - :config - (setq which-key-side-window-location 'bottom - which-key-sort-order #'which-key-key-order-alpha - 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.3 - which-key-max-description-length 25 - which-key-allow-imprecise-window-fit nil - which-key-separator " → " )) -#+end_src diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el deleted file mode 100644 index 512068a..0000000 --- a/.config/emacs/early-init.el +++ /dev/null @@ -1 +0,0 @@ -(setq package-enable-at-startup nil)