From fe020e9939fe7fd93f505ee6a2020473318211de Mon Sep 17 00:00:00 2001 From: Elais Player Date: Sun, 14 Jun 2020 20:50:51 -0600 Subject: [PATCH] modify keybindings to take advantage of new leader maps --- lisp/shao-completion.el | 2 ++ lisp/shao-defaults.el | 22 ++++++++++++++++------ lisp/shao-fingers.el | 32 ++++++++++++++++++++------------ lisp/shao-projects.el | 7 +++++++ lisp/shao-snippets.el | 11 ++++++----- lisp/shao-vc.el | 38 ++++++++++++++++++++++++++++++++++---- 6 files changed, 85 insertions(+), 27 deletions(-) diff --git a/lisp/shao-completion.el b/lisp/shao-completion.el index 1939f46..02526d9 100644 --- a/lisp/shao-completion.el +++ b/lisp/shao-completion.el @@ -66,6 +66,8 @@ (company-prescient-mode +1)) (use-package selectrum + :custom-face + (selectrum-current-candidate ((t (:inherit region)))) :config (selectrum-mode +1)) diff --git a/lisp/shao-defaults.el b/lisp/shao-defaults.el index ee1f9e8..b7e2357 100644 --- a/lisp/shao-defaults.el +++ b/lisp/shao-defaults.el @@ -19,8 +19,19 @@ (savehist-mode +1) (setq-default save-place t) -;; Packages +;; +;;; Functions +;; +;;; Packages + +(use-package general + :demand t) + +(use-package hl-line + :config + (global-hl-line-mode +1)) + (use-package paren :config (show-paren-mode +1)) @@ -30,13 +41,12 @@ (electric-pair-mode +1)) (use-package abbrev - :config - (setq save-abbrevs 'silently)) + :custom + (save-abbrevs 'silently)) (use-package recentf - :init - (global-set-key (kbd "C-x C-r") 'recentf-open-files) - (setq recentf-max-saved-items 50) + :custom + (recentf-max-saved-items 50) :config (recentf-mode +1)) diff --git a/lisp/shao-fingers.el b/lisp/shao-fingers.el index b7899a6..986e0f0 100644 --- a/lisp/shao-fingers.el +++ b/lisp/shao-fingers.el @@ -30,25 +30,30 @@ (defvar +shaolin-buffer-map (make-sparse-keymap)) ;; -;;; Packages +;;; Functions -(use-package general - :demand t - :config - (general-define-key +(defun +recentf-open-files () + "Use `completing-read' to open a recent file." + (interactive) + (let ((files (mapcar 'abbreviate-file-name recentf-list))) + (find-file (completing-read "Find recent file: " files nil t)))) + +(general-define-key :keymaps #'+shaolin-files-map "s" 'save-buffer - "f" 'find-file) - - (general-create-definer shaolin-fingers-def - :keymaps '+shaolin-fingers-map - "f" #'+shaolin-files-map - "b" #'+shaolin-buffer-map)) + "f" 'find-file + "r" '+recentf-open-files) + +(general-create-definer shaolin-fingers-def + :prefix "x" + :keymaps '(boon-command-map boon-special-map)) + +;; +;;; Packages (use-package which-key :diminish which-key-mode :custom - (which-key-sort-order #'which-key-prefix-then-key-order) (which-key-sort-uppercase-first nil) (which-key-add-column-padding 1) (which-key-max-display-columns nil) @@ -66,6 +71,9 @@ (use-package boon-qwerty :demand t + :general + (shaolin-fingers-def + :keymaps 'boon-special-map) :config (boon-mode +1)) diff --git a/lisp/shao-projects.el b/lisp/shao-projects.el index b81dc29..9508687 100644 --- a/lisp/shao-projects.el +++ b/lisp/shao-projects.el @@ -29,11 +29,16 @@ (envrc-global-mode)) (use-package projectile + :diminish projectile-mode + :general + (shaolin-fingers-def + "p" '(:keymap projectile-command-map :wk "[p]rojects")) :commands (projectile-project-root projectile-project-name projectile-project-p projectile-locate-dominating-file) :custom + (projectile-completion-system 'default) ; uses selectrum (projectile-ignored-projects '("~/" "/tmp")) (projectile-globally-ignored-files '(".DS_Store" "Icon " "TAGS")) (projectile--globally-ignored-file-suffixes '(".elc" ".pyc" ".o")) @@ -41,6 +46,8 @@ (append '(".projectile" ".project" ".git"))) + :init + (global-set-key [remap find-tag] #'projectile-find-tag) :config (projectile-mode +1)) diff --git a/lisp/shao-snippets.el b/lisp/shao-snippets.el index cd3e007..e864464 100644 --- a/lisp/shao-snippets.el +++ b/lisp/shao-snippets.el @@ -17,16 +17,14 @@ ;; ;; ;; -;;; Code: - -;;; Variables +;;; code: (defvar +guix-snippets-dir (expand-file-name ".local/guix-profiles/emacs/emacs-profile/share/emacs/yasnippet-snippets/" user-emacs-directory) "Directory where `yasnippet-dirs' something.") - + (defvar +file-templates-dir (expand-file-name "etc/yasnippet/templates/file/" @@ -56,6 +54,8 @@ information.") ;;; Packages (use-package yasnippet + :custom + (yas-snippet-dirs '(+file-templates-dir)) :commands (yas-minor-mode-on yas-expand yas-expand-snippet @@ -69,7 +69,8 @@ information.") (conf-mode . yas-minor-mode)) :config (add-to-list 'yas-snippet-dirs '+guix-snippets-dir) - (add-to-list 'yas-snippet-dirs '+file-templates-dir) + (setq yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions)) + (add-to-list 'yas-snippet-dirs '+file-templates-dir 'append #'eq) (yas-reload-all)) (provide 'shao-snippets) diff --git a/lisp/shao-vc.el b/lisp/shao-vc.el index 4cd88e3..02f7568 100644 --- a/lisp/shao-vc.el +++ b/lisp/shao-vc.el @@ -1,4 +1,25 @@ -;;; shao-vc.el -*- lexical-binding: t; -*- +;;; shao-vc --- version control -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2020 Elais Player +;; +;; Author: Elais +;; Maintainer: Elais Player +;; Created: June 14, 2020 +;; Modified: June 14, 2020 +;; Version: 0.0.1 +;; Keywords: +;; Homepage: https://git.sr.ht/YY/shaolin-emacs +;; Package-Requires: ((emacs YY)) +;; +;; This file is not part of GNU Emacs. +;; +;;; Commentary: +;; +;; +;; +;;; Code: + + ;; stolen from doom-emacs ;;;###autoload @@ -35,8 +56,17 @@ (use-package magit :general - ("C-x g" 'magit-status) - :init - (setq magit-display-buffer-function #'+magit-display-buffer-fn)) + (shaolin-fingers-def + "g" '(:ignore t :wk ("[g]it" . "version control")) + "gg" '(magit-status :wk "[g]it status") + "gb" '(magit-branch :wk "[b]ranch") + "gl" '(magit-log :wk "[l]og") + ;; Magit Creation Commands + "gc" '(:ignore t :wk "[c]ommit") + "gcc" '(magit-commit-create :wk "[c]reate")) + :commands (magit-status magit-branch magit-commit) + :custom + (magit-display-buffer-function #'+magit-display-buffer-fn)) (provide 'shao-vc) +;;; shao-vc.el ends here -- 2.45.2