From ee122a814fcef73cb36aac172f85df901d1ff487 Mon Sep 17 00:00:00 2001 From: shoshin Date: Sun, 22 May 2022 19:54:09 -0500 Subject: Add: major keybinding section and completion configs --- shoshin-config.el | 43 ++++++++++++++++++++++++++--- shoshin-config.org | 79 ++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 110 insertions(+), 12 deletions(-) diff --git a/shoshin-config.el b/shoshin-config.el index 803af5d..f14c432 100644 --- a/shoshin-config.el +++ b/shoshin-config.el @@ -1,19 +1,54 @@ ;;; shoshimacs.el --- Beginner's Mind Config -*- lexical-binding:t -*- ;;; Package Management -(when (string< "28.1" emacs-version) +(when (< emacs-major-version 28) (add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/"))) +(when (and (functionp #'native-comp-available-p) (native-comp-available-p)) + (setq native-comp-always-compile t + package-native-compile t)) + +;;; Major Keybinding +(package-install 'xah-fly-keys) +(xah-fly-keys-set-layout "qwerty") +(setq xah-fly-use-control-key nil + xah-fly-use-meta-key nil) +(xah-fly-keys t) + ;;; Completion +(setq completion-styles '(flex basic partial-completion emacs22) + completion-cycle-threshold 3 + tab-always-indent 'complete) + (package-install 'consult) +(define-key xah-fly-leader-key-map (kbd "f") #'consult-buffer) +(define-key xah-fly-command-map (kbd "n") #'consult-line) -(package-install 'corfu) +(global-set-key (kbd "C-x b") #'consult-buffer) +(define-key xah-fly-leader-key-map (kbd "f") #'consult-buffer) +(define-key xah-fly-command-map (kbd "n") #'consult-line) -(package-install 'marginalia) +(package-install 'corfu) +(setq corfu-auto t + corfu-cycle t + corfu-quit-no-match t) +(global-corfu-mode t) (package-install 'embark) +(package-install 'marginalia) +(marginalia-mode) + (package-install 'vertico) +(setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) +(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) +(setq read-extended-command-predicate + #'command-completion-default-include-p) +(setq enable-recursive-minibuffers t) + +(package-install 'which-key) +(which-key-mode) ;;; Editing (electric-pair-mode) @@ -42,7 +77,7 @@ (package-install 'darkroom) -(set-frame-font "Victor Mono" t t t) +(set-frame-font "Victor Mono") (global-hl-line-mode t) diff --git a/shoshin-config.org b/shoshin-config.org index 725faca..7f07b3c 100644 --- a/shoshin-config.org +++ b/shoshin-config.org @@ -33,6 +33,9 @@ is tangled into the resulting elisp file: ;;; Package Management <> + ;;; Major Keybinding + <> + ;;; Completion <> @@ -87,7 +90,7 @@ distributions may not yet have it as an available package. #+name: add-nongnu-elpa #+begin_src emacs-lisp - (when (string< "28.1" emacs-version) + (when (< emacs-major-version 28) (add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/"))) #+end_src @@ -123,11 +126,33 @@ manually install it by cloning the repo and adding it to the however, it is now in non-gnu elpa! so i don't need this anymore. -* Keybindings +** Emacs 28 native compilation + +[[info:elisp#Native Compilation][elisp#Native Compilation]] + +#+begin_src emacs-lisp + (when (and (functionp #'native-comp-available-p) (native-comp-available-p)) + (setq native-comp-always-compile t + package-native-compile t)) +#+end_src + +* Keybinding + +keybindings are the key to playing Emacs like an instrument. no matter +what you choose, keep in mind that you can always bind keys to your +most commonly used commands to make things convienient. + +i highly recommend creating a personal key map bound to a "leader key". +you initiate it with the leader, and then bind following key sequences +to commands you use. creating your own will make it easier to remember +and keep organized. + ** xah-fly-keys -this is what i adopted to combat rsi and have trained my muscle memory to. +this is what i adopted to combat rsi. my muscle memory is tied into it +tightly right now. you may have other opinions about keybindings +#+name: keybinding #+begin_src emacs-lisp (package-install 'xah-fly-keys) (xah-fly-keys-set-layout "qwerty") @@ -136,6 +161,9 @@ this is what i adopted to combat rsi and have trained my muscle memory to. (xah-fly-keys t) #+end_src +i'm setting it up early in the config so that its keymaps are available +to modify / integrate with other packages. + * Completion :PROPERTIES: :header-args:emacs-lisp: :noweb-ref completion :noweb-sep "\n\n" :results silent @@ -150,6 +178,16 @@ that tie into Emacs's native completion API. This is a more modular approach that allows a sort of composition of extensions to completion behavior and its appearance in the user interface. +** Emacs completion styles + +[[info:emacs#Completion Styles][emacs#Completion Styles]] + +#+begin_src emacs-lisp + (setq completion-styles '(flex basic partial-completion emacs22) + completion-cycle-threshold 3 + tab-always-indent 'complete) +#+end_src + ** [[info:consult#Top][consult]] - Consulting [[info:elisp#Minibuffer Completion][completing-read]] consult offers enhanced completion similar to ivy and helm, but with the @@ -157,6 +195,8 @@ built in completing read functionality of the minibuffer. #+begin_src emacs-lisp (package-install 'consult) + (define-key xah-fly-leader-key-map (kbd "f") #'consult-buffer) + (define-key xah-fly-command-map (kbd "n") #'consult-line) #+end_src main entry point would be ~consult-buffer~. however, there are many consult @@ -171,29 +211,52 @@ the new. it seems like consult does this as well as switching themes /as you narrow your selection/. *** consult keybindings +#+begin_src emacs-lisp + (global-set-key (kbd "C-x b") #'consult-buffer) + (define-key xah-fly-leader-key-map (kbd "f") #'consult-buffer) + (define-key xah-fly-command-map (kbd "n") #'consult-line) +#+end_src ** corfu #+begin_src emacs-lisp (package-install 'corfu) + (setq corfu-auto t + corfu-cycle t + corfu-quit-no-match t) + (global-corfu-mode t) #+end_src -** marginalia +** embark #+begin_src emacs-lisp - (package-install 'marginalia) + (package-install 'embark) #+end_src -** embark +** marginalia #+begin_src emacs-lisp - (package-install 'embark) + (package-install 'marginalia) + (marginalia-mode) #+end_src ** vertico #+begin_src emacs-lisp (package-install 'vertico) + (setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + (setq read-extended-command-predicate + #'command-completion-default-include-p) + (setq enable-recursive-minibuffers t) +#+end_src + +** which-key + +#+begin_src emacs-lisp + (package-install 'which-key) + (which-key-mode) #+end_src * Editing @@ -309,7 +372,7 @@ Warning (comp): darkroom.el:365:10: Warning: function ‘darkroom-tentative-mode For code, I've grown fond of Victor Mono. #+begin_src emacs-lisp - (set-frame-font "Victor Mono" t t t) + (set-frame-font "Victor Mono") #+end_src *** COMMENT Attempt to install the font via Emacs, url.el and ~make-process~ -- cgit v1.2.3