From 5928d69052627f2b520431e599185bbde6607123 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Tue, 18 Oct 2022 01:32:23 +0800 Subject: [PATCH] add which-key --- .gitignore | 4 ++ .gitmodules | 3 ++ init.el | 15 ++++++++ lisp/init-built-in.el | 79 +++++++++++++++++++++++++++++++++++++++ site-lisp/emacs-which-key | 1 + 5 files changed, 102 insertions(+) create mode 100644 lisp/init-built-in.el create mode 160000 site-lisp/emacs-which-key diff --git a/.gitignore b/.gitignore index 593674f..dd32a3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /auto-save-list/ /transient/ /elpa/ +/projects +/places +/ido.last +/history diff --git a/.gitmodules b/.gitmodules index 45bbc02..22891b2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "site-lisp/lazy-load"] path = site-lisp/lazy-load url = https://github.com/manateelazycat/lazy-load.git +[submodule "site-lisp/emacs-which-key"] + path = site-lisp/emacs-which-key + url = https://github.com/justbur/emacs-which-key.git diff --git a/init.el b/init.el index 1875a8b..dca9447 100644 --- a/init.el +++ b/init.el @@ -1,3 +1,5 @@ +;; -*- coding: utf-8; lexical-binding: t; -*- + (defvar creature-gc-cons-threshold (if (display-graphic-p) (* 64 1024 1024) (* 16 1024 1024)) "The default value to use for `gc-cons-threshold'. @@ -93,12 +95,25 @@ If freezing sometimes, decrease it. If stuttering, increase it.") (add-subdirs-to-load-path subdir-path))))) (add-subdirs-to-load-path creature/pkg-dir) +(add-to-list 'load-path (expand-file-name "lisp" creature/config-dir) t) (require 'lazy-load) (lazy-load-global-keys '(("C-x g" . magit-status)) "magit") +(require 'init-built-in) + +(require 'which-key) +(setq which-key-show-early-on-C-h t) +(setq which-key-idle-delay 10000) +(setq which-key-idle-secondary-delay 0.05) +(which-key-mode 'toggle) + +(setq custom-file (expand-file-name "custom.el" creature/cache-dir)) +(when (file-exists-p custom-file) + (load custom-file 'noerror)) + (add-hook 'emacs-startup-hook (lambda () (message (emacs-init-time)))) diff --git a/lisp/init-built-in.el b/lisp/init-built-in.el new file mode 100644 index 0000000..540566f --- /dev/null +++ b/lisp/init-built-in.el @@ -0,0 +1,79 @@ +;; -*- coding: utf-8; lexical-binding: t; -*- + +;; Encoding +(prefer-coding-system 'utf-8) +(setq locale-coding-system 'utf-8) +(set-language-environment 'utf-8) +(set-default-coding-systems 'utf-8) +(set-buffer-file-coding-system 'utf-8) +(set-clipboard-coding-system 'utf-8) +(set-file-name-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-selection-coding-system 'utf-8) +(modify-coding-system-alist 'process "*" 'utf-8) + +;; Don't show prompt when call function +(fset 'yes-or-no-p 'y-or-n-p) +(put 'erase-buffer 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-defun 'disable nil) +(put 'narrow-to-region 'disabled nil) + +;; Always use space for indentation +(setq-default tab-width 4) +(setq-default indent-tabs-mode nil) + +;; Highlight trail whitespace +(setq show-trailing-whitespace t) + +(global-whitespace-mode 1) + + +;; Save minibuffer history +(savehist-mode) +(setq history-length 1000 + savehist-autosave-interval 60 + enable-recursive-minibuffers t + savehist-additional-variables '(mark-ring + global-mark-ring + search-ring + regexp-search-ring + extended-command-history)) + +;; Record cursor position for file +(save-place-mode) + +;; Delete file directly +(setq delete-by-moving-to-trash t) + +;; No backup file +(setq make-backup-files nil) + +;; Auto save file +(setq auto-save-default t) +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) + +;; Disable bell +(setq visible-bell nil + ring-bell-function 'ignore) + +;; Keep cursor at end of lines when prev +;; position of cursor is at the end. +;; Require line-move-visual is nil. +;; (setq track-eol t +;; line-move-visual nil) + +;; Do not show startup screen +(setq inhibit-splash-screen t ; no startup screen + x-gtk-use-system-tooltips nil) ; no gtk tooltips + +(electric-pair-mode 1) +(electric-quote-mode 1) +(electric-indent-mode 1) + +(setq epg-pinentry-mode 'loopback) + + +(provide 'init-built-in) diff --git a/site-lisp/emacs-which-key b/site-lisp/emacs-which-key new file mode 160000 index 0000000..8093644 --- /dev/null +++ b/site-lisp/emacs-which-key @@ -0,0 +1 @@ +Subproject commit 8093644032854b1cdf3245ce4e3c7b6673f741bf