Browse Source

Change leader keys into variables

master
Riyyi 4 years ago
parent
commit
98d806ca1b
  1. 27
      .emacs.d/config.org
  2. 17
      .emacs.d/init.el

27
.emacs.d/config.org

@ -146,7 +146,9 @@ Install and configure packages.
:after evil
:custom
(evil-collection-company-use-tng nil)
(evil-collection-key-blacklist '("M-h" "M-j" "M-k" "M-l" "SPC"))
(evil-collection-key-blacklist (list dot/leader-key dot/localleader-key
dot/leader-alt-key dot/localleader-alt-key
"M-h" "M-j" "M-k" "M-l"))
(evil-collection-setup-minibuffer t)
:config (evil-collection-init))
@ -300,7 +302,7 @@ On the fly syntax checking.
:config
;; Enable which-key descriptions
(dolist (leader-key (list "SPC" "M-SPC"))
(dolist (leader-key (list dot/leader-key dot/leader-alt-key))
(let ((lsp-keymap-prefix (concat leader-key " l")))
(lsp-enable-which-key-integration)))
@ -889,7 +891,7 @@ Disable spacebar in evil motion.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'evil-states
(define-key evil-motion-state-map (kbd "SPC") nil))
(define-key evil-motion-state-map (kbd dot/leader-key) nil))
(with-eval-after-load 'php-mode
(define-key php-mode-map (kbd "C-M-h") nil))
@ -1001,11 +1003,10 @@ General.el ~leader key binds.
*** Global
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'general
(general-create-definer space-leader
:prefix "SPC"
:non-normal-prefix "M-SPC"
:global-prefix "M-SPC"
:prefix dot/leader-key
:non-normal-prefix dot/leader-alt-key
:global-prefix dot/leader-alt-key
:states '(normal visual insert motion emacs))
(space-leader
@ -1114,7 +1115,7 @@ General.el ~leader key binds.
;; winner-undo
"x" '(smex-major-mode-commands :which-key "Smex major mode")
))
)
#+END_SRC
Evaluated keybinds.
@ -1135,14 +1136,14 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el
#+BEGIN_SRC emacs-lisp
(general-create-definer local-leader
:prefix "SPC m"
:non-normal-prefix "M-SPC m"
:global-prefix "M-SPC m"
:prefix dot/localleader-key
:non-normal-prefix dot/localleader-alt-key
:global-prefix dot/localleader-alt-key
:states '(normal visual insert motion emacs)
)
(which-key-add-key-based-replacements "SPC m" "<local leader>")
(which-key-add-key-based-replacements "M-SPC m" "<local leader>")
(which-key-add-key-based-replacements dot/localleader-key "<localleader>")
(which-key-add-key-based-replacements dot/localleader-alt-key "<localleader>")
(local-leader org-mode-map
"'" '(org-edit-special :which-key "Org edit")

17
.emacs.d/init.el

@ -1,4 +1,4 @@
;;; package --- Emacs init file
;;; init.el --- Emacs init file
;;; Commentary:
@ -7,17 +7,24 @@
;;; Code:
;; Increases garbage collection during startup
(defvar startup/gc-cons-threshold gc-cons-threshold)
(setq gc-cons-threshold most-positive-fixnum)
(defun startup/reset-gc () "." (setq gc-cons-threshold startup/gc-cons-threshold))
(add-hook 'emacs-startup-hook 'startup/reset-gc)
(add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold 8000000)))
; --------------------------------------
(defvar emacs-cache (concat (getenv "XDG_CACHE_HOME") "/emacs")
"Directory where Emacs cache data is stored.")
(defvar emacs-d (concat (getenv "HOME") "/.emacs.d")
"Additional per-user Emacs-specific files.")
"Directory where Emacs config files are stored.")
(defvar dot/leader-key "SPC"
"Leader prefix key.")
(defvar dot/leader-alt-key "M-SPC"
"Alternative leader prefix key, used for Insert and Emacs states.")
(defvar dot/localleader-key "SPC m"
"Local leader prefix key, for 'major-mode' specific commands.")
(defvar dot/localleader-alt-key "M-SPC m"
"Alternative local leader prefix key, used for Insert and Emacs states.")
; --------------------------------------

Loading…
Cancel
Save