From dd467e8d2838802086537b7bed282d7007b5a952 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Fri, 8 Sep 2023 23:15:01 +0400 Subject: [PATCH] goodbye init.el --- config/emacs/emacs.org | 204 +++++++++++++++++++++++ config/emacs/init-new.el | 31 ---- config/emacs/init.el | 350 --------------------------------------- 3 files changed, 204 insertions(+), 381 deletions(-) delete mode 100644 config/emacs/init-new.el delete mode 100644 config/emacs/init.el diff --git a/config/emacs/emacs.org b/config/emacs/emacs.org index a8a46100..9f07ec24 100644 --- a/config/emacs/emacs.org +++ b/config/emacs/emacs.org @@ -59,6 +59,10 @@ M-x org-bable-tangle (setq use-package-always-ensure t) #+end_src ** Packages +*** Command Log Mode +#+begin_src emacs-lisp + (use-package command-log-mode) +#+end_src *** Command Autocompletion Packages #+begin_src emacs-lisp ;; better search @@ -163,6 +167,206 @@ M-x org-bable-tangle ([remap describe-variable] . counsel-describe-variable) ([remap describe-key] . helpful-key)) #+end_src +*** General Leader Key +#+begin_src emacs-lisp +(use-package general + :config + (general-create-definer sakomacs/leader-keys + :keymaps `(normal insert visual emacs) + :prefix "SPC" + :global-prefix "C-SPC") + (sakomacs/leader-keys + "t" `(:ignore t :which-key "toggles") + "tt" `(counsel-load-theme :which-key "choose theme"))) +#+end_src +*** Evil Mode (vim) +#+begin_src emacs-lisp +(use-package evil + :init + (setq evil-want-integration t) + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + (setq evil-want-C-i-jump nil) + :hook (evil-mode . sakomacs/evil-hook) + :ensure t + :demand + :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) + + ;; visual line motion + (evil-global-set-key 'motion "j" 'evil-next-visual-line) + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + + (evil-set-initial-state 'messages-buffer-mode 'normal) + (evil-set-initial-state 'dashboard-mode 'normal)) + +;; extra things for Evil +(use-package evil-collection + :after evil + :config + (evil-collection-init)) +#+end_src +*** Hydra for scaling text +#+begin_src emacs-lisp +(use-package hydra) +(defhydra hydra-text-scale (:timeout 4) + "scale text" + ("j" text-scale-increase "in") + ("k" text-scale-decrease "out") + ("f" nil "finished" :exit t)) + +(sakomacs/leader-keys + "ts" '(hydra-text-scale/body :which-key "scale text")) +#+end_src +*** Helpful for projects +#+begin_src emacs-lisp +(use-package projectile + :diminish projectile-mode + :demand + :config (projectile-mode) + :custom ((projectile-completion-system 'ivy)) + :bind-keymap + ("C-c p" . projectile-command-map) + :init + (when (file-directory-p "~/dev") + (setq projectile-project-search-path '("~/dev"))) + (setq projectile-switch-project-action #'projectile-dired)) + +(use-package counsel-projectile + :config (counsel-projectile-mode)) +#+end_src +*** Org-Mode +#+begin_src emacs-lisp +(defun sakomacs/org-mode-setup () + (org-indent-mode) + (variable-pitch-mode 1) + (visual-line-mode 1)) + +(use-package org + :hook (org-mode . sakomacs/org-mode-setup) + :config + (setq org-ellipsis "▼") + (setq org-agenda-start-with-log-mode t) + (setq org-log-done 'time) + (setq org-log-into-drawer t) + + ;; org habits thing + (require 'org-habit) + (add-to-list 'org-modules 'org-habit) + (setq org-habit-graph-column 60) + + ;; archive thingy i forgot + (setq org-refile-targets + '(("archive.org" :maxlevel . 1))) + + ;; save org buffer before refile + (advice-add 'org-refile :after 'org-save-all-org-buffers) + + ;; org mode src thing + (require 'org-tempo) + + (add-to-list 'org-structure-template-alist '("sh" . "src shell")) + (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) + (add-to-list 'org-structure-template-alist '("py" . "src python")) + + ;; extra keywords + (setq org-todo-keywords + '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") + (sequence "PLAN(p)" "READY(r)" "ACTIVE(a)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)") ) + + ;; custom commands for org-agenda + (setq org-agenda-custom-commands + '(("d" "Dashboard" + ((agenda "" ((org-deadline-warning-days 7))) + (todo "NEXT" + ((org-agenda-overriding-header "Next Tasks"))) + (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects"))))) + + ("n" "Next Tasks" + ((todo "NEXT" + ((org-agenda-overriding-header "Next Tasks"))))) + + ("W" "Work Tasks" tags-todo "+work-email") + + ;; Low-effort next actions + ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0" + ((org-agenda-overriding-header "Low Effort Tasks") + (org-agenda-max-todos 20) + (org-agenda-files org-agenda-files))) + + ("w" "Workflow Status" + (todo "PLAN" + ((org-agenda-overriding-header "In Planning") + (org-agenda-todo-list-sublevels nil) + (org-agenda-files org-agenda-files))) + (todo "READY" + ((org-agenda-overriding-header "Ready for Work") + (org-agenda-files org-agenda-files))) + (todo "ACTIVE" + ((org-agenda-overriding-header "Active Projects") + (org-agenda-files org-agenda-files))) + (todo "COMPLETED" + ((org-agenda-overriding-header "Completed Projects") + (org-agenda-files org-agenda-files))) + (todo "CANC" + ((org-agenda-overriding-header "Cancelled Projects") + (org-agenda-files org-agenda-files))))))) + + (setq org-agenda-files + '("~/org/tasks.org") + '("~/org/work.org")) + + (setq org-adapt-indentation t) + + (setq org-capture-templates + `(("t" "Tasks / Projects") + ("tt" "Task" entry (file+olp "~/org/tasks.org" "Inbox") + "* TODO %?\n %U\n %a\n %i" :empty-lines 1)))) + + +;; i need more bullets, i need more bullets, i need more bullets, bigger weapons, bigger weapons, bigger weapons +;; thanks for the protein sir +(use-package org-bullets + :after org + :hook (org-mode . org-bullets-mode) + :custom + (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●"))) + +;; word +(defun sakomacs/org-mode-visual-fill () + (setq visual-fill-column-width 100 + visual-fill-column-center-text t) + (visual-fill-column-mode 1)) + +(use-package visual-fill-column + :hook (org-mode . sakomacs/org-mode-visual-fill)) +#+end_src +*** Development Specific +**** Magit (git in emacs) +#+begin_src emacs-lisp +(use-package magit + :custom + (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) +#+end_src +**** Forge for Magit (Adds github, gitlab, etc PRs and Issues to magit) +make sure to setup authinfo +#+begin_src emacs-lisp +(use-package forge + :after magit) +(setq auth-sources '("~/.authinfo")) +#+end_src +**** Lsp-mode +***** Inital Setup +#+begin_src emacs-lisp +(use-package lsp-mode + :commands (lsp lsp-deferred) + :init + (setq lsp-keymap-prefix "C-c l") + :config + (lsp-enable-which-key-integration t)) +#+end_src * Org Mode Configuration Setup ** Babel Languages #+begin_src emacs-lisp diff --git a/config/emacs/init-new.el b/config/emacs/init-new.el deleted file mode 100644 index 30cc1ecd..00000000 --- a/config/emacs/init-new.el +++ /dev/null @@ -1,31 +0,0 @@ -;; UI/UX -(setq inhibit-startup-message t) -;; make it look like neovim a little -(scroll-bar-mode -1) -(tool-bar-mode -1) -(tooltip-mode -1) -(set-fringe-mode 10) -(menu-bar-mode -1) -;; Line Numbers -(column-number-mode) -(global-display-line-numbers-mode t) -;; disable line numbers on some modes -(dolist (mode '(org-mode-hook - term-mode-hook - eshell-mode-hook)) - (add-hook mode (lambda () (display-line-numbers-mode 0)))) -;; Bell -(setq visible-bell t) - -;; Font -(set-face-attribute `default nil :font "JetBrains Mono" :height 125) - -(org-babel-tangle) -(org-babel-tangle-file "~/nixos/config/emacs/emacs.org") - -(defun sakomacs/org-babel-tangle-config () - (when (string-equal (buffer-file-name) - (expand-file-name "~/nixos/config/emacs/emacs.org")) - (let ((org-confirm-babel-evaluate nil)) - (org-babel-tangle))) - (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'sakomacs/org-babel-tangle-config)))) diff --git a/config/emacs/init.el b/config/emacs/init.el deleted file mode 100644 index 79c41a53..00000000 --- a/config/emacs/init.el +++ /dev/null @@ -1,350 +0,0 @@ -;; Ui/UX -(setq inhibit-startup-message t) - -;; make it look like neovim a little -(scroll-bar-mode -1) -(tool-bar-mode -1) -(tooltip-mode -1) -(set-fringe-mode 10) - -(menu-bar-mode -1) - -;; Line Numbers -(column-number-mode) -(global-display-line-numbers-mode t) - -(dolist (mode '(org-mode-hook - term-mode-hook - eshell-mode-hook)) - (add-hook mode (lambda () (display-line-numbers-mode 0)))) - -;; Bell -(setq visible-bell t) - -;; Font -(set-face-attribute `default nil :font "JetBrains Mono" :height 125) - -;; Keymaps -(global-set-key (kbd "C-M-j") 'counsel-switch-buffer) - -;; Make ESC quit prompts -(global-set-key (kbd "") 'keyboard-escape-quit) - -;; Package related stuqff -(require `package) - -(setq package-archives `(("mepla" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) - -(package-initialize) -(unless package-archive-contents - (package-refresh-contents)) - -;; Init package for non-linux -(unless (package-installed-p `use-package) - (package-install `use-package)) - -(require 'use-package) -(setq use-package-always-ensure t) - -;; for showing commands -(use-package command-log-mode) - -;; better search -(use-package swiper) -;; better commands -(use-package counsel) -;; autocompletion on commands (?) -(use-package ivy - :diminish - :bind (("C-s" . swiper) - :map ivy-minibuffer-map - ("TAB" . ivy-alt-done) - ("C-l" . ivy-alt-done) - ("C-j" . ivy-next-line) - ("C-k" . ivy-previous-line) - :map ivy-switch-buffer-map - ("C-k" . ivy-previous-line) - ("C-l" . ivy-done) - ("C-d" . ivy-switch-buffer-kill) - :map ivy-reverse-i-search-map - ("C-k" . ivy-previous-line) - ("C-d" . ivy-reverse-i-search-kill)) - :demand - :config - (ivy-mode 1)) -;; better ivy autocompletion -(use-package ivy-rich - :init - (ivy-rich-mode 1)) - -;; counsel M+X -(use-package counsel - :bind (("M-x" . counsel-M-x) - ("C-x b" . counsel-ibuffer) - ("C-x C-f" . counsel-find-file) - :map minibuffer-local-map - ("C-r" . 'counsel-minibuffer-history)) - :config - (setq ivy-inital-inputs-alist nil)) - -;; doom themes - -(use-package doom-themes - :ensure t - :config - ;; Global settings (defaults) - (setq doom-themes-enable-bold t ; if nil, bold is universally disabled - doom-themes-enable-italic t) ; if nil, italics is universally disabled - ;; load the theme - (load-theme 'doom-monokai-pro t) - - ;; Enable flashing mode-line on errors - (doom-themes-visual-bell-config)) - ;; Enable custom neotree theme (all-the-icons must be installed!) - ;;(doom-themes-neotree-config) - ;; or for treemacs users - ;;(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme - ;;(doom-themes-treemacs-config) - ;; Corrects (and improves) org-mode's native fontification. - ;;(doom-themes-org-config)) - -;; nerd-fonts instead of all-the-icons -(use-package nerd-icons - :custom - ;; "Symbols Nerd Font Mono" is the default and is recommended - ;; but you can use any other Nerd Font if you want - (nerd-icons-font-family "JetBrainsMono NF") - ) - -;; better statusbar -(use-package doom-modeline - :ensure t - :init (doom-modeline-mode 1) - :custom ((doom-modeline-height 35))) - - -;; continue configuring from here -;; https://youtu.be/74zOY-vgkyw?t=3125 - -;; rainbow delimiters for lisp (TODO find this for javascript, c++ etc) -(use-package rainbow-delimiters - :hook (prog-mode . rainbow-delimiters-mode)) - -;; which-key because i dont know what emacs is -(use-package which-key - :init (which-key-mode) - :diminish which-key-mode - :config - (setq which-key-idle-delay 1)) - -;; better help menu -(use-package helpful - :ensure t - :custom - (counsel-describe-function-function #'helpful-callable) - (counsel-describe-variable-function #'helpful-variable) - :bind - ([remap describe-function ] . counsel-describe-function) - ([remap describe-command] . helpful-command) - ([remap describe-variable] . counsel-describe-variable) - ([remap describe-key] . helpful-key)) - -;; general emacs -(use-package general - :config - (general-create-definer sakomacs/leader-keys - :keymaps `(normal insert visual emacs) - :prefix "SPC" - :global-prefix "C-SPC") - (sakomacs/leader-keys - "t" `(:ignore t :which-key "toggles") - "tt" `(counsel-load-theme :which-key "choose theme"))) - -;; EVIL !!!! ITS EVIL I TELL YOU !!!!!!!!!!!! -;; vim like because nothing beats vim keybindings -(use-package evil - :init - (setq evil-want-integration t) - (setq evil-want-keybinding nil) - (setq evil-want-C-u-scroll t) - (setq evil-want-C-i-jump nil) - :hook (evil-mode . sakomacs/evil-hook) - :ensure t - :demand - :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) - - ;; visual line motion - (evil-global-set-key 'motion "j" 'evil-next-visual-line) - (evil-global-set-key 'motion "k" 'evil-previous-visual-line) - - (evil-set-initial-state 'messages-buffer-mode 'normal) - (evil-set-initial-state 'dashboard-mode 'normal)) - -;; extra things for Evil -(use-package evil-collection - :after evil - :config - (evil-collection-init)) - -;; hydra for text scale -(use-package hydra) -(defhydra hydra-text-scale (:timeout 4) - "scale text" - ("j" text-scale-increase "in") - ("k" text-scale-decrease "out") - ("f" nil "finished" :exit t)) - -(sakomacs/leader-keys - "ts" '(hydra-text-scale/body :which-key "scale text")) - -;; for specific projects -(use-package projectile - :diminish projectile-mode - :demand - :config (projectile-mode) - :custom ((projectile-completion-system 'ivy)) - :bind-keymap - ("C-c p" . projectile-command-map) - :init - (when (file-directory-p "~/dev") - (setq projectile-project-search-path '("~/dev"))) - (setq projectile-switch-project-action #'projectile-dired)) - -(use-package counsel-projectile - :config (counsel-projectile-mode)) - -;; git -(use-package magit - :custom - (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) - -;; github notifications in my editor my favorite -;; needs OLD not NEW github token -(use-package forge - :after magit) -(setq auth-sources '("~/.authinfo")) - - -;; emacs is good at most things -;; except editing text ofc - -(defun sakomacs/org-mode-setup () - (org-indent-mode) - (variable-pitch-mode 1) - (visual-line-mode 1)) - -(use-package org - :hook (org-mode . sakomacs/org-mode-setup) - :config - (setq org-ellipsis "▼") - (setq org-agenda-start-with-log-mode t) - (setq org-log-done 'time) - (setq org-log-into-drawer t) - - ;; org habits thing - (require 'org-habit) - (add-to-list 'org-modules 'org-habit) - (setq org-habit-graph-column 60) - - ;; archive thingy i forgot - (setq org-refile-targets - '(("archive.org" :maxlevel . 1))) - - ;; save org buffer before refile - (advice-add 'org-refile :after 'org-save-all-org-buffers) - - ;; org mode src thing - (require 'org-tempo) - - (add-to-list 'org-structure-template-alist '("sh" . "src shell")) - (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) - (add-to-list 'org-structure-template-alist '("py" . "src python")) - - ;; extra keywords - (setq org-todo-keywords - '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") - (sequence "PLAN(p)" "READY(r)" "ACTIVE(a)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)") ) - - ;; custom commands for org-agenda - (setq org-agenda-custom-commands - '(("d" "Dashboard" - ((agenda "" ((org-deadline-warning-days 7))) - (todo "NEXT" - ((org-agenda-overriding-header "Next Tasks"))) - (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects"))))) - - ("n" "Next Tasks" - ((todo "NEXT" - ((org-agenda-overriding-header "Next Tasks"))))) - - ("W" "Work Tasks" tags-todo "+work-email") - - ;; Low-effort next actions - ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0" - ((org-agenda-overriding-header "Low Effort Tasks") - (org-agenda-max-todos 20) - (org-agenda-files org-agenda-files))) - - ("w" "Workflow Status" - (todo "PLAN" - ((org-agenda-overriding-header "In Planning") - (org-agenda-todo-list-sublevels nil) - (org-agenda-files org-agenda-files))) - (todo "READY" - ((org-agenda-overriding-header "Ready for Work") - (org-agenda-files org-agenda-files))) - (todo "ACTIVE" - ((org-agenda-overriding-header "Active Projects") - (org-agenda-files org-agenda-files))) - (todo "COMPLETED" - ((org-agenda-overriding-header "Completed Projects") - (org-agenda-files org-agenda-files))) - (todo "CANC" - ((org-agenda-overriding-header "Cancelled Projects") - (org-agenda-files org-agenda-files))))))) - - (setq org-agenda-files - '("~/org/tasks.org") - '("~/org/work.org")) - - (setq org-adapt-indentation t) - - (setq org-capture-templates - `(("t" "Tasks / Projects") - ("tt" "Task" entry (file+olp "~/org/tasks.org" "Inbox") - "* TODO %?\n %U\n %a\n %i" :empty-lines 1)))) - - -;; i need more bullets, i need more bullets, i need more bullets, bigger weapons, bigger weapons, bigger weapons -;; thanks for the protein sir -(use-package org-bullets - :after org - :hook (org-mode . org-bullets-mode) - :custom - (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●"))) - -;; word -(defun sakomacs/org-mode-visual-fill () - (setq visual-fill-column-width 100 - visual-fill-column-center-text t) - (visual-fill-column-mode 1)) - -(use-package visual-fill-column - :hook (org-mode . sakomacs/org-mode-visual-fill)) - -;; lsp finally -(use-package lsp-mode - :commands (lsp lsp-deferred) - :init - (setq lsp-keymap-prefix "C-c l") - :config - (lsp-enable-which-key-integration t)) - -;; video -;; oh my god we can configure emacs with org mode what is this -;; https://www.youtube.com/watch?v=kkqVTDbfYp4