perf: general improvements

This commit is contained in:
Muhammad Nauman Raza 2022-11-20 08:03:40 +00:00
parent 641286d3ce
commit 05cc2fb09d
No known key found for this signature in database
GPG key ID: A9A36C429C9CAE31
5 changed files with 79 additions and 87 deletions

View file

@ -55,4 +55,7 @@
(convert-standard-filename "user/"))) (convert-standard-filename "user/")))
(load "init") (load "init")
;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 2 1000 1000))
;;; init.el ends here ;;; init.el ends here

View file

@ -25,23 +25,39 @@
;; evil-commentary - Comment stuff out ;; evil-commentary - Comment stuff out
(use-package evil-commentary (use-package evil-commentary
:after evil
:init :init
(evil-commentary-mode)) (evil-commentary-mode))
;; evil-surround - You will be surrounded
(use-package evil-surround
:after evil
:init
(global-evil-surround-mode))
;; evil-snipe - 2-char searching for evil-mode
(use-package evil-snipe
:after evil
:init
(evil-snipe-override-mode 1))
;; evil-collection - A collection of keybinds for evil ;; evil-collection - A collection of keybinds for evil
(use-package evil-collection (use-package evil-collection
:after evil
:custom (evil-collection-setup-minibuffer t) :custom (evil-collection-setup-minibuffer t)
:init (evil-collection-init)) :init (evil-collection-init))
;; evil-escape - Escape from insert mode using jk ;; evil-escape - Escape from insert mode using jk
(use-package evil-escape (use-package evil-escape
:after evil
:config :config
(setq-default evil-escape-key-sequence "jk") (setq-default evil-escape-key-sequence "jk")
:init :init
(evil-escape-mode 1)) (evil-escape-mode 1))
;; undo-fu, used by evil for undo/redo functionality ;; undo-fu, used by evil for undo/redo functionality
(use-package undo-fu) (use-package undo-fu
:after evil)
;; Disable the creation of files ending with '~' (backup files) ;; Disable the creation of files ending with '~' (backup files)
(setq make-backup-files nil) (setq make-backup-files nil)
@ -53,13 +69,6 @@
(setq auto-save-file-name-transforms (setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t))) `((".*" ,temporary-file-directory t)))
;; Themes
;; Customize doom-themes
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(doom-themes-treemacs-config) ; Enable theming of treemacs
(doom-themes-org-config) ; And org-mode
;; Set theme to `graphite', Dianicemacs' default ;; Set theme to `graphite', Dianicemacs' default
(use-package autothemer) (use-package autothemer)
(use-package graphite-theme (use-package graphite-theme
@ -72,26 +81,22 @@
:hook :hook
(prog-mode . rainbow-mode)) (prog-mode . rainbow-mode))
;; Keybinds
;; Enable which-key
(which-key-mode)
(setq which-key-idle-delay 0.1) ; Make the popup appear faster
(setq which-key-separator " - " ) ; Change the seperator which-key uses
;; general - More convenient key definitions for Emacs ;; general - More convenient key definitions for Emacs
(use-package general (use-package general
:after evil
:config :config
(general-evil-setup t) (general-evil-setup t)
:init :init
(general-create-definer diancite/leaders (general-create-definer diancite/leaders
:prefix leader-key)) :prefix leader-key))
(with-eval-after-load 'general
(diancite/leaders (diancite/leaders
:keymaps 'normal :keymaps 'normal
"f" '(:wk "File") "f" '(:wk "File")
"n" '(:wk "Org") "n" '(:wk "Org")
"m" '(:wk "Magit") "m" '(:wk "Magit")
"w" '(:wk "Evil") "w" '(:wk "Evil")
"p" '(:wk "Projects")) "p" '(:wk "Projects")))
;;; editor.el ends here ;;; editor.el ends here

View file

@ -22,8 +22,8 @@
;; Add a nice border around Emacs ;; Add a nice border around Emacs
(modify-all-frames-parameters (modify-all-frames-parameters
'((right-divider-width . 15) '((right-divider-width . 20)
(internal-border-width . 15))) (internal-border-width . 20)))
(dolist (face '(window-divider (dolist (face '(window-divider
window-divider-first-pixel window-divider-first-pixel
window-divider-last-pixel)) window-divider-last-pixel))
@ -31,8 +31,14 @@
(set-face-foreground face (face-attribute 'default :background))) (set-face-foreground face (face-attribute 'default :background)))
(set-face-background 'fringe (face-attribute 'default :background)) (set-face-background 'fringe (face-attribute 'default :background))
;; vertico - An amazing search engine!
(use-package vertico
:init
(vertico-mode 1))
;; Use the `orderless' completion mechanism ;; Use the `orderless' completion mechanism
(use-package orderless (use-package orderless
:after vertico
:init :init
(setq completion-styles '(orderless basic) (setq completion-styles '(orderless basic)
completion-category-defaults nil completion-category-defaults nil
@ -52,23 +58,12 @@
(use-package magit) (use-package magit)
;; which-key - a popup which displays available keybindings ;; which-key - a popup which displays available keybindings
(use-package which-key) (use-package which-key
;; Themes
;; Install the Doom Emacs theme megapack.
(use-package doom-themes)
;; kaolin-themes, depends on autothemer
(use-package kaolin-themes
:requires autothemer)
;; all-the-icons - Icons for various UI elements
(use-package all-the-icons)
;; vertico - An amazing search engine!
(use-package vertico
:init :init
(vertico-mode 1)) (which-key-mode)
:custom
(which-key-idle-delay 0.1) ; Make the popup appear faster
(which-key-separator " - ")) ; Change the seperator which-key uses
(use-package diredfl ; Colourise dired! (use-package diredfl ; Colourise dired!
:hook dired-mode) :hook dired-mode)

View file

@ -9,10 +9,11 @@
;; org-mode ;; org-superstar ;; org-mode ;; org-superstar
(use-package org-superstar (use-package org-superstar
:config :custom
;; Change org-mode's heading bullets ;; Change org-mode's heading bullets
(setq org-superstar-headline-bullets-list (org-superstar-headline-bullets-list
'("🞉" "🞈" "🞇" "🞆" "🞅" "🞄"))) '("🞉" "🞈" "🞇" "🞆" "🞅" "🞄"))
:hook org-mode)
;; Customize org-mode's default functionality ;; Customize org-mode's default functionality
(setq org-ellipsis "..." (setq org-ellipsis "..."
@ -24,9 +25,9 @@
org-startup-with-inline-images t org-startup-with-inline-images t
org-image-actual-width '(300) org-image-actual-width '(300)
org-pretty-entities t org-pretty-entities t
org-hide-leading-stars t
org-adapt-indentation t) org-adapt-indentation t)
(with-eval-after-load 'org-superstar
;; Faces for the font sizes of org-mode headings ;; Faces for the font sizes of org-mode headings
(set-face-attribute 'org-level-8 nil :weight 'bold :inherit 'default) (set-face-attribute 'org-level-8 nil :weight 'bold :inherit 'default)
(set-face-attribute 'org-level-7 nil :inherit 'org-level-8) (set-face-attribute 'org-level-7 nil :inherit 'org-level-8)
@ -39,27 +40,23 @@
(set-face-attribute 'org-document-title nil (set-face-attribute 'org-document-title nil
:height 1.85 :height 1.85
:foreground 'unspecified :foreground 'unspecified
:inherit 'org-level-8) :inherit 'org-level-8))
;; Scale up latex elements (with-eval-after-load 'org
(plist-put org-format-latex-options :scale 2.5) (plist-put org-format-latex-options :scale 2.5) ; Scale up latex elements
(setq org-directory "~/Org/") ; Set the folder used by org-mode
;; Enable org-superstar-mode in org-mode files (setq org-agenda-files (quote ("~/Org/")))
(add-hook 'org-mode-hook 'org-superstar-mode) (setq org-roam-directory "~/Org/Roam/")) ; Set the folder used by org-roam
;; org-roam - A plain-text personal knowledge management system ;; org-roam - A plain-text personal knowledge management system
(use-package org-roam (use-package org-roam
:custom
(org-directory file-truename "~/Org/") ; Set the folder used by org-mode
(org-roam-directory (file-truename "~/Org/Roam/")) ; Set the folder used by org-roam
:init :init
(org-roam-db-autosync-mode 1)) ; Automatically sync nodes (org-roam-db-autosync-mode 1)
(setq org-roam-capture-templates (setq org-roam-capture-templates
'(("d" "default" plain '(("d" "default" plain
"\n%?" "\n%?"
:if-new (file+head "${slug}.org" "#+title: ${title}\n#+date: %U\n#+author: %n\n") :if-new (file+head "${slug}.org" "#+title: ${title}\n#+date: %U\n#+author: %n\n")
:unnarrowed t))) :unnarrowed t)))) ; Automatically sync nodes
;; Keybinds for org-mode ;; Keybinds for org-mode
;; evil-org - Some nice keybinds for org-mode and org-agenda ;; evil-org - Some nice keybinds for org-mode and org-agenda
@ -71,9 +68,8 @@
(require 'evil-org-agenda) (require 'evil-org-agenda)
(evil-org-agenda-set-keys)) (evil-org-agenda-set-keys))
(general-create-definer diancite/org (with-eval-after-load 'general
:prefix leader-key) (general-create-definer diancite/org :prefix leader-key)
(diancite/org (diancite/org
:keymaps 'normal :keymaps 'normal
"n r" '(org-roam-node-find :wk "Find Nodes") "n r" '(org-roam-node-find :wk "Find Nodes")
@ -81,8 +77,6 @@
"n c" '(org-todo :wk "Cycle Todo") "n c" '(org-todo :wk "Cycle Todo")
"n l" '(org-latex-preview :wk "Preview Latex") "n l" '(org-latex-preview :wk "Preview Latex")
"n a" '(org-agenda :wk "Agenda") "n a" '(org-agenda :wk "Agenda")
"n t" '(org-table-align :wk "Align Table")) "n t" '(org-table-align :wk "Align Table")))
(setq org-agenda-files (quote ("~/Org")))
;;; org-mode.el ends here ;;; org-mode.el ends here

View file

@ -6,12 +6,7 @@
;; ;;
;;; Code: ;;; Code:
;; Reduce garbage collection at startup ;; Increase the threshold
(setq gc-cons-threshold most-positive-fixnum) (setq gc-cons-threshold (* 50 1000 1000))
;; Lower threshold back to 8 MiB (default is 800kB)
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold (expt 2 23))))
;;; performance.el ends here ;;; performance.el ends here