From bcb6f7a1a37d590f13bf142f1865e5925da304af Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Tue, 8 Nov 2022 17:53:07 +0000 Subject: [PATCH] feat: which-key --- init.el | 11 +++++++---- lisp/editor.el | 13 ++++++++++++- lisp/packages.el | 12 ++++++++---- lisp/performance.el | 12 ++++++++++++ 4 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 lisp/performance.el diff --git a/init.el b/init.el index 0beea96..9559865 100644 --- a/init.el +++ b/init.el @@ -24,13 +24,16 @@ (straight-use-package 'use-package) (setq straight-use-package-by-default t) -;; Disable the creation of files ending with '~' -(setq make-backup-files nil) +;; Always make sure packages are installed to the system +(setq use-package-always-ensure t) +;; Add external e-lisp files to the load-path (add-to-list 'load-path (concat user-emacs-directory (convert-standard-filename "lisp/"))) -(require 'interface) +;; Load the code of some external files (require 'packages) -(require 'org-mode) +(require 'interface) (require 'editor) +(require 'org-mode) +(require 'performance) diff --git a/lisp/editor.el b/lisp/editor.el index 2d6e4e3..1587a56 100644 --- a/lisp/editor.el +++ b/lisp/editor.el @@ -1,10 +1,15 @@ ;;; This file customizes Emacs' editor +;; Quit input dialogues after pressing escape once +(global-set-key (kbd "") 'keyboard-escape-quit) + ;;; evil - A Vi Layer inside of Emacs -(setq evil-undo-system 'undo-fu) ; Enable undo/redo functionality using undo-fu (evil-collection-init) ; Enable the evil-collection keybinds (evil-mode 1) ; Enable evil +;; Disable the creation of files ending with '~' (backup files) +(setq make-backup-files nil) + ;;; Themes ;; Customize doom-themes (setq doom-themes-enable-bold t @@ -15,5 +20,11 @@ ;; Set theme to doom-tokyo-night, Dianicemacs' default (load-theme 'doom-tokyo-night t) +;;; 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 + ;; Provide this file to init.el (provide 'editor) diff --git a/lisp/packages.el b/lisp/packages.el index bd84df9..31f21be 100644 --- a/lisp/packages.el +++ b/lisp/packages.el @@ -22,16 +22,20 @@ ;;; evil - A Vi layer inside of Emacs (use-package evil - :config + :init (setq evil-want-keybinding nil ; Make room for evil-collection - evil-want-integration t) ; Same as above - :requires (undo-fu evil-collection)) + evil-want-integration t ; Same as above + evil-undo-system 'undo-fu)) ; Set the undo/redo system ;; A collection of keybinds for evil-mode -(use-package evil-collection) +(use-package evil-collection + :after evil) ; In order to recognize evil-want-... being set ;; undo-fu, used by evil for undo/redo functionality (use-package undo-fu) +;;; Keybinds +(use-package which-key) + ;; Provide this file to init.el (provide 'packages) diff --git a/lisp/performance.el b/lisp/performance.el new file mode 100644 index 0000000..9c0d108 --- /dev/null +++ b/lisp/performance.el @@ -0,0 +1,12 @@ +;;; This file improves the performance of Emacs, startup or otherwise + +;; Reduce garbage collection at startup +(setq gc-cons-threshold most-positive-fixnum) + +;; Lower threshold back to 8 MiB (default is 800kB) +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold (expt 2 23)))) + +;; Provide this file to init.el +(provide 'performance)