Merge branch 'integrate-defkey' into 'master'
Integrate defkey, improve evil support See merge request FG42/FG42!22
This commit is contained in:
commit
15c343f192
|
@ -34,7 +34,9 @@
|
|||
(with-ability git
|
||||
(depends-on 'diff-hl)
|
||||
(depends-on 'magit)
|
||||
(depends-on 'gh))
|
||||
(depends-on 'gh)
|
||||
(when (is-evil?)
|
||||
(depends-on 'evil-magit)))
|
||||
|
||||
(with-ability github
|
||||
(depends-on 'magithub))
|
||||
|
|
|
@ -180,7 +180,11 @@
|
|||
(cheatsheet-add :group '--Development--
|
||||
:key "C-x g"
|
||||
:description "Rise up MAGIT. Git interface for FG42")
|
||||
(global-set-key (kbd "C-x g") 'magit-status))
|
||||
(global-set-key (kbd "C-x g") 'magit-status)
|
||||
(when (is-evil?)
|
||||
(add-hook 'magit-mode-hook (lambda () (require 'evil-magit)))
|
||||
(defkey global-map 'magit-status :evil (:normal "SPC g s"))))
|
||||
|
||||
|
||||
(ability github ()
|
||||
"Github support"
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
|
||||
(depends-on 'eyebrowse)
|
||||
|
||||
;; general for simpler keybinding
|
||||
(depends-on 'general)
|
||||
|
||||
;; Themes
|
||||
(depends-on 'spacemacs-theme)
|
||||
(depends-on 'doom-themes)
|
||||
|
@ -83,6 +80,8 @@
|
|||
(with-ability tabbar
|
||||
(depends-on 'tabbar))
|
||||
|
||||
(with-ability which-key
|
||||
(depends-on 'which-key))
|
||||
(if (eq system-type 'darwin)
|
||||
(depends-on 'exec-path-from-shell))
|
||||
|
||||
|
|
|
@ -70,6 +70,31 @@
|
|||
(set-face-attribute 'default t :font fg42-font))
|
||||
;; ------------------------------------------------------
|
||||
|
||||
(ability which-key ()
|
||||
(when (is-evil?)
|
||||
(which-key-mode t)))
|
||||
|
||||
;; enhance evil mode with space leader keybindings
|
||||
(ability space-keys (which-key)
|
||||
"evil mode with space leader keybindings"
|
||||
(when (is-evil?)
|
||||
(defkey global-map 'find-file :evil (:normal "SPC f f"))
|
||||
(defkey global-map 'kill-buffer :evil (:normal "SPC b k"))
|
||||
(defkey global-map 'save-buferr :evil (:normal "SPC b s"))
|
||||
(defkey global-map 'next-buffer :evil (:normal "SPC b n"))
|
||||
(defkey global-map 'previous-buffer :evil (:normal "SPC b p"))
|
||||
(defkey global-map 'switch-to-buffer :evil (:normal "SPC b l"))
|
||||
(defkey global-map 'other-window :evil (:normal "SPC w o"))
|
||||
(defkey global-map 'delete-window :evil (:normal "SPC w d"))
|
||||
(defkey global-map 'delete-other-windows :evil (:normal "SPC w m"))
|
||||
(defkey global-map 'split-window-vertically :evil (:normal "SPC w s v"))
|
||||
(defkey global-map 'eval-last-sexp :evil (:normal "SPC e e"))
|
||||
(defkey global-map 'eval-buffer :evil (:normal "SPC e b"))
|
||||
(defkey global-map 'comment-line :evil (:normal "SPC l c"))
|
||||
(defkey global-map 'describe-key :evil (:normal "SPC d k"))
|
||||
(defkey global-map 'describe-function :evil (:normal "SPC d f"))
|
||||
(defkey global-map 'describe-variable :evil (:normal "SPC d v"))))
|
||||
|
||||
(cheatsheet-add :group '--HELP--
|
||||
:key "C-?"
|
||||
:description "Show this cheatsheet")
|
||||
|
@ -105,22 +130,7 @@
|
|||
(ability highligh-current-line ()
|
||||
"Highlights the current line."
|
||||
(global-hl-line-mode t))
|
||||
|
||||
;; enhance evil mode with space leader keybindings
|
||||
(ability space-keys
|
||||
"evil mode with space leader keybindings"
|
||||
(when (is-evil?)
|
||||
(general-define-key
|
||||
:states '(normal visual insert emacs)
|
||||
:prefix "SPC"
|
||||
:non-normal-prefix "C-SPC"
|
||||
"bl" 'switch-to-buffer
|
||||
"ff" 'find-file
|
||||
"sv" 'split-window-vertically
|
||||
"sh" 'split-window-horizontally)))
|
||||
|
||||
|
||||
(ability flycheck ()
|
||||
(ability flycheck ()
|
||||
"Check syntax on the fly using flycheck."
|
||||
(require 'flycheck)
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
(require 'fg42/splash)
|
||||
(require 'fg42/race)
|
||||
(require 'fg42/utils)
|
||||
(require 'fg42/key-bindings)
|
||||
|
||||
|
||||
(defvar fg42-before-initialize-hook nil
|
||||
"This hook will be called before FG42 initilization process.")
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(require 'fg42/race)
|
||||
|
||||
(defun -defkey-god (map key fn)
|
||||
"Set the given KEY on key map MAP to FN."
|
||||
|
@ -56,10 +55,12 @@ Example usage :
|
|||
\\(defkey `'global-map`' 'goto-line
|
||||
:evil \\(:normal \"SPC s u\"\\)
|
||||
:god \"<f2>\"\\)"
|
||||
|
||||
(let ((god-key (plist-get keys :god))
|
||||
(human-key (plist-get keys :human))
|
||||
(evil-state-key (plist-get keys :evil)))
|
||||
(when (and (is-evil?) (null evil-state-key)) (error "You should pass :evil keys when you are evil user"))
|
||||
(when (and (is-god?) (null god-key)) (error "You should pass :god keys when you are a god user"))
|
||||
(when (and (is-human?) (null human-key)) (error "You should pass :evil keys when you are a human user"))
|
||||
(cond
|
||||
((is-god?) `(-defkey-god ,map ,god-key ,fn))
|
||||
((is-human?) `(-defkey-human ,map ,human-key ,fn))
|
||||
|
|
Loading…
Reference in New Issue