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 :after evil
:custom :custom
(evil-collection-company-use-tng nil) (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) (evil-collection-setup-minibuffer t)
:config (evil-collection-init)) :config (evil-collection-init))
@ -300,7 +302,7 @@ On the fly syntax checking.
:config :config
;; Enable which-key descriptions ;; 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"))) (let ((lsp-keymap-prefix (concat leader-key " l")))
(lsp-enable-which-key-integration))) (lsp-enable-which-key-integration)))
@ -889,7 +891,7 @@ Disable spacebar in evil motion.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(with-eval-after-load 'evil-states (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 (with-eval-after-load 'php-mode
(define-key php-mode-map (kbd "C-M-h") nil)) (define-key php-mode-map (kbd "C-M-h") nil))
@ -1001,11 +1003,10 @@ General.el ~leader key binds.
*** Global *** Global
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(with-eval-after-load 'general
(general-create-definer space-leader (general-create-definer space-leader
:prefix "SPC" :prefix dot/leader-key
:non-normal-prefix "M-SPC" :non-normal-prefix dot/leader-alt-key
:global-prefix "M-SPC" :global-prefix dot/leader-alt-key
:states '(normal visual insert motion emacs)) :states '(normal visual insert motion emacs))
(space-leader (space-leader
@ -1114,7 +1115,7 @@ General.el ~leader key binds.
;; winner-undo ;; winner-undo
"x" '(smex-major-mode-commands :which-key "Smex major mode") "x" '(smex-major-mode-commands :which-key "Smex major mode")
)) )
#+END_SRC #+END_SRC
Evaluated keybinds. Evaluated keybinds.
@ -1135,14 +1136,14 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(general-create-definer local-leader (general-create-definer local-leader
:prefix "SPC m" :prefix dot/localleader-key
:non-normal-prefix "M-SPC m" :non-normal-prefix dot/localleader-alt-key
:global-prefix "M-SPC m" :global-prefix dot/localleader-alt-key
:states '(normal visual insert motion emacs) :states '(normal visual insert motion emacs)
) )
(which-key-add-key-based-replacements "SPC m" "<local leader>") (which-key-add-key-based-replacements dot/localleader-key "<localleader>")
(which-key-add-key-based-replacements "M-SPC m" "<local leader>") (which-key-add-key-based-replacements dot/localleader-alt-key "<localleader>")
(local-leader org-mode-map (local-leader org-mode-map
"'" '(org-edit-special :which-key "Org edit") "'" '(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: ;;; Commentary:
@ -7,17 +7,24 @@
;;; Code: ;;; Code:
;; Increases garbage collection during startup ;; Increases garbage collection during startup
(defvar startup/gc-cons-threshold gc-cons-threshold)
(setq gc-cons-threshold most-positive-fixnum) (setq gc-cons-threshold most-positive-fixnum)
(defun startup/reset-gc () "." (setq gc-cons-threshold startup/gc-cons-threshold)) (add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold 8000000)))
(add-hook 'emacs-startup-hook 'startup/reset-gc)
; -------------------------------------- ; --------------------------------------
(defvar emacs-cache (concat (getenv "XDG_CACHE_HOME") "/emacs") (defvar emacs-cache (concat (getenv "XDG_CACHE_HOME") "/emacs")
"Directory where Emacs cache data is stored.") "Directory where Emacs cache data is stored.")
(defvar emacs-d (concat (getenv "HOME") "/.emacs.d") (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