Use dotspacemacs backward compatibility macro instead of aliases
This commit is contained in:
parent
434df17f8b
commit
b282e553ba
|
@ -14,6 +14,11 @@
|
|||
(defvar spacemacs-repl-list '()
|
||||
"List of all registered REPLs.")
|
||||
|
||||
(defmacro spacemacs|dotspacemacs-backward-compatibility (variable default)
|
||||
"Return `if' sexp for backward compatibility with old dotspacemacs
|
||||
values."
|
||||
`(if (boundp ',variable) ,variable ',default))
|
||||
|
||||
(defun spacemacs/system-is-mac ()
|
||||
(eq system-type 'darwin))
|
||||
(defun spacemacs/system-is-linux ()
|
||||
|
|
|
@ -289,7 +289,7 @@ MODE parameter must match the :modes values used in the call to
|
|||
(cond
|
||||
((or (eq 'vim style)
|
||||
(and (eq 'hybrid style)
|
||||
hybrid-mode-enable-hjkl-bindings))
|
||||
hybrid-style-enable-hjkl-bindings))
|
||||
(let ((map company-active-map))
|
||||
(define-key map (kbd "C-j") 'company-select-next)
|
||||
(define-key map (kbd "C-k") 'company-select-previous)
|
||||
|
|
|
@ -125,7 +125,7 @@ if set the layer variable =spacemacs-helm-rg-max-column-number=.
|
|||
* Key bindings
|
||||
** hjkl navigation
|
||||
When using the Vim style or Hybrid style with the variable
|
||||
=hybrid-mode-enable-hjkl-bindings= set to =t=, Spacemacs adds navigation in the
|
||||
=hybrid-style-enable-hjkl-bindings= set to =t=, Spacemacs adds navigation in the
|
||||
Helm buffers with ~hjkl~.
|
||||
|
||||
| Key Binding | Description |
|
||||
|
|
|
@ -14,24 +14,19 @@
|
|||
;; TODO: remove dotspacemacs variables backward compatbility in version
|
||||
;; 0.400 or later
|
||||
|
||||
(defmacro spacemacs|helm-backward-compatibility (variable default)
|
||||
"Return `or' sexp for backward compatibility with old dotspacemacs
|
||||
values."
|
||||
`(or (and (boundp ',variable) ,variable) ',default))
|
||||
|
||||
(defvar helm-enable-auto-resize (spacemacs|helm-backward-compatibility
|
||||
(defvar helm-enable-auto-resize (spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-helm-resize nil)
|
||||
"If non nil, `helm' will try to minimize the space it uses.")
|
||||
|
||||
(defvar helm-no-header (spacemacs|helm-backward-compatibility
|
||||
(defvar helm-no-header (spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-helm-no-header nil)
|
||||
"if non nil, the helm header is hidden when there is only one source.")
|
||||
|
||||
(defvar helm-position (spacemacs|helm-backward-compatibility
|
||||
(defvar helm-position (spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-helm-position bottom)
|
||||
"Position in which to show the `helm' mini-buffer.")
|
||||
|
||||
(defvar helm-use-fuzzy (spacemacs|helm-backward-compatibility
|
||||
(defvar helm-use-fuzzy (spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-helm-use-fuzzy always)
|
||||
"Controls fuzzy matching in helm. If set to `always', force fuzzy matching
|
||||
in all non-asynchronous sources. If set to `source', preserve individual
|
||||
|
|
|
@ -46,23 +46,26 @@ to a major mode, a list of such symbols, or the symbol t,
|
|||
acting as default. The values are either integers, symbols
|
||||
or lists of these.")
|
||||
|
||||
(defvar vim-style-remap-Y-to-y$ nil
|
||||
(defvar vim-style-remap-Y-to-y$
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-remap-Y-to-y$ nil)
|
||||
"If non nil `Y' is remapped to `y$' in Evil states.")
|
||||
(defvaralias 'dotspacemacs-remap-Y-to-y$ 'vim-style-remap-Y-to-y$)
|
||||
|
||||
(defvar vim-style-retain-visual-state-on-shift t
|
||||
(defvar vim-style-retain-visual-state-on-shift
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-retain-visual-state-on-shift t)
|
||||
"If non-nil, the shift mappings `<' and `>' retain visual state
|
||||
if used there.")
|
||||
(defvaralias 'dotspacemacs-retain-visual-state-on-shift
|
||||
'vim-style-retain-visual-state-on-shift)
|
||||
|
||||
(defvar vim-style-visual-line-move-text nil
|
||||
(defvar vim-style-visual-line-move-text
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-visual-line-move-text nil)
|
||||
"If non-nil, J and K move lines up and down when in visual mode.")
|
||||
(defvaralias 'dotspacemacs-visual-line-move-text 'vim-style-visual-line-move-text)
|
||||
|
||||
(defvar vim-style-ex-substitute-global nil
|
||||
(defvar vim-style-ex-substitute-global
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-ex-substitute-global nil)
|
||||
"If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.")
|
||||
(defvaralias 'dotspacemacs-ex-substitute-global 'vim-style-ex-substitute-global)
|
||||
|
||||
;; State cursors
|
||||
(defvar spacemacs-evil-cursors '(("normal" "DarkGoldenrod2" box)
|
||||
|
|
|
@ -77,7 +77,7 @@ For evil states that also need an entry to `spacemacs-evil-cursors' use
|
|||
(cond
|
||||
((or (eq 'vim style)
|
||||
(and (eq 'hybrid style)
|
||||
(bound-and-true-p hybrid-mode-use-evil-search-module)))
|
||||
(bound-and-true-p hybrid-style-use-evil-search-module)))
|
||||
;; if Evil is loaded already, just setting `evil-search-module' isn't
|
||||
;; enough, we need to call `evil-select-search-module' as well (this is done
|
||||
;; automatically when `evil-search-module' is changed via customize)
|
||||
|
|
|
@ -31,33 +31,35 @@
|
|||
|
||||
(require 'evil)
|
||||
|
||||
(defcustom hybrid-mode-default-state 'normal
|
||||
|
||||
(defcustom hybrid-style-default-state
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
hybrid-mode-default-state normal)
|
||||
"Value of `evil-default-state' for hybrid-mode."
|
||||
:group 'spacemacs
|
||||
:type 'symbol)
|
||||
(defvaralias 'hybrid-style-default-state 'hybrid-mode-default-state)
|
||||
|
||||
(defcustom hybrid-mode-enable-hjkl-bindings nil
|
||||
(defcustom hybrid-style-enable-hjkl-bindings
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
hybrid-mode-enable-hjkl-bindings nil)
|
||||
"If non-nil then packages configuration should enable hjkl navigation."
|
||||
:group 'spacemacs
|
||||
:type 'boolean)
|
||||
(defvaralias 'hybrid-style-enable-hjkl-bindings
|
||||
'hybrid-mode-enable-hjkl-bindings)
|
||||
|
||||
(defcustom hybrid-mode-enable-evilified-state t
|
||||
(defcustom hybrid-style-enable-evilified-state
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
hybrid-mode-enable-evilified-state t)
|
||||
"If non-nil then evilified states is enabled in buffer supporting it."
|
||||
:group 'spacemacs
|
||||
:type 'boolean)
|
||||
(defvaralias 'hybrid-style-enable-evilified-state
|
||||
'hybrid-mode-enable-evilified-state)
|
||||
|
||||
(defcustom hybrid-mode-use-evil-search-module nil
|
||||
(defcustom hybrid-style-use-evil-search-module
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
hybrid-mode-use-evil-search-module nil)
|
||||
"If non-nil then use evil own search module which is closer to Vim search
|
||||
behavior (for instance it support C-r pasting)."
|
||||
:group 'spacemacs
|
||||
:type 'boolean)
|
||||
(defvaralias 'hybrid-style-use-evil-search-module
|
||||
'hybrid-mode-use-evil-search-module)
|
||||
|
||||
(defvar hybrid-mode-default-state-backup evil-default-state
|
||||
"Backup of `evil-default-state'.")
|
||||
|
@ -70,7 +72,7 @@ behavior (for instance it support C-r pasting)."
|
|||
"Forces Hybrid state."
|
||||
(if (equal -1 (ad-get-arg 0))
|
||||
ad-do-it
|
||||
(if hybrid-mode-enable-evilified-state
|
||||
(if hybrid-style-enable-evilified-state
|
||||
ad-do-it
|
||||
;; seems better to set the emacs state instead of hybrid for evilified
|
||||
;; buffers
|
||||
|
@ -89,7 +91,7 @@ behavior (for instance it support C-r pasting)."
|
|||
(defun enable-hybrid-editing-style ()
|
||||
"Enable the hybrid editing style."
|
||||
(setq hybrid-mode-default-state-backup evil-default-state
|
||||
evil-default-state hybrid-mode-default-state)
|
||||
evil-default-state hybrid-style-default-state)
|
||||
;; replace evil states by `hybrid state'
|
||||
(ad-enable-advice 'evil-insert-state
|
||||
'around 'hybrid-insert-to-hybrid-state)
|
||||
|
@ -165,7 +167,7 @@ behavior (for instance it support C-r pasting)."
|
|||
(if (memq major-mode evil-evilified-state-modes)
|
||||
(evil-evilified-state)
|
||||
(funcall (intern (format "evil-%S-state"
|
||||
hybrid-mode-default-state)))))
|
||||
hybrid-style-default-state)))))
|
||||
((and (eq 'vim style)
|
||||
(memq evil-state '(hybrid emacs)))
|
||||
(cond
|
||||
|
|
|
@ -79,10 +79,10 @@
|
|||
(define-key evil-normal-state-map (kbd dotspacemacs-ex-command-key) 'evil-ex)
|
||||
(define-key evil-visual-state-map (kbd dotspacemacs-ex-command-key) 'evil-ex)
|
||||
(define-key evil-motion-state-map (kbd dotspacemacs-ex-command-key) 'evil-ex)
|
||||
(setq evil-ex-substitute-global dotspacemacs-ex-substitute-global)
|
||||
(setq evil-ex-substitute-global vim-style-ex-substitute-global)
|
||||
|
||||
;; evil-want-Y-yank-to-eol must be set via customize to have an effect
|
||||
(customize-set-variable 'evil-want-Y-yank-to-eol dotspacemacs-remap-Y-to-y$)
|
||||
(customize-set-variable 'evil-want-Y-yank-to-eol vim-style-remap-Y-to-y$)
|
||||
|
||||
;; bind evil-jump-forward for GUI only.
|
||||
(define-key evil-motion-state-map [C-i] 'evil-jump-forward)
|
||||
|
@ -114,12 +114,12 @@
|
|||
(add-hook 'after-change-major-mode-hook 'spacemacs//set-evil-shift-width 'append)
|
||||
|
||||
;; Keep the region active when shifting
|
||||
(when dotspacemacs-retain-visual-state-on-shift
|
||||
(when vim-style-retain-visual-state-on-shift
|
||||
(evil-map visual "<" "<gv")
|
||||
(evil-map visual ">" ">gv"))
|
||||
|
||||
;; move selection up and down
|
||||
(when dotspacemacs-visual-line-move-text
|
||||
(when vim-style-visual-line-move-text
|
||||
(define-key evil-visual-state-map "J" (concat ":m '>+1" (kbd "RET") "gv=gv"))
|
||||
(define-key evil-visual-state-map "K" (concat ":m '<-2" (kbd "RET") "gv=gv")))
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ Unlike `eval-defun', this does not go to topmost function."
|
|||
"Additional processing when `edebug-mode' is activated or deactivated."
|
||||
(let ((evilified (or (eq 'vim dotspacemacs-editing-style)
|
||||
(and (eq 'hybrid dotspacemacs-editing-style)
|
||||
hybrid-mode-enable-evilified-state))))
|
||||
hybrid-style-enable-evilified-state))))
|
||||
(if (not edebug-mode)
|
||||
;; disable edebug-mode
|
||||
(when evilified (evil-normal-state))
|
||||
|
|
|
@ -56,7 +56,7 @@ Will work on both org-mode and any mode that accepts plain html."
|
|||
"Set promotion/demotiion on 'hjkl' for the given editing STYLE."
|
||||
(when (or (eq 'vim style)
|
||||
(and (eq 'hybrid style)
|
||||
hybrid-mode-enable-hjkl-bindings))
|
||||
hybrid-style-enable-hjkl-bindings))
|
||||
(dolist (s '(normal insert))
|
||||
(evil-define-key s markdown-mode-map
|
||||
(kbd "M-h") 'markdown-promote
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
"Return non-nil if evil navigation should be enabled for STYLE."
|
||||
(or (eq style 'vim)
|
||||
(and (eq style 'hybrid)
|
||||
hybrid-mode-enable-evilified-state)))
|
||||
hybrid-style-enable-evilified-state)))
|
||||
|
||||
(defun spacemacs//magit-evil-magit-bindings (style)
|
||||
"Set `evil-magit' bindings for the given editing STYLE."
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
(cond
|
||||
((or (eq 'vim style)
|
||||
(and (eq 'hybrid style)
|
||||
hybrid-mode-enable-hjkl-bindings))
|
||||
hybrid-style-enable-hjkl-bindings))
|
||||
(define-key helm-map (kbd "C-j") 'helm-next-line)
|
||||
(define-key helm-map (kbd "C-k") 'helm-previous-line)
|
||||
(define-key helm-map (kbd "C-S-j") 'helm-follow-action-forward)
|
||||
|
@ -194,7 +194,7 @@ See https://github.com/syl20bnr/spacemacs/issues/3700"
|
|||
(cond
|
||||
((or (eq 'vim style)
|
||||
(and (eq 'hybrid style)
|
||||
hybrid-mode-enable-hjkl-bindings))
|
||||
hybrid-style-enable-hjkl-bindings))
|
||||
(define-key ivy-minibuffer-map (kbd "C-j") 'ivy-next-line)
|
||||
(define-key ivy-minibuffer-map (kbd "C-k") 'ivy-previous-line)
|
||||
(define-key ivy-minibuffer-map (kbd "C-h") (kbd "DEL"))
|
||||
|
|
Loading…
Reference in New Issue