Improve helm micro-state
bind actions to numbers add custom variable spacemaces-helm-micro-state-color `l` and `h` are now used to got the next/previous source
This commit is contained in:
parent
798ef87427
commit
9bb0500ca8
2 changed files with 39 additions and 16 deletions
|
@ -972,13 +972,23 @@ will turn-off the micro-state).
|
||||||
Key Binding | Description
|
Key Binding | Description
|
||||||
--------------------|------------------------------------------------------------
|
--------------------|------------------------------------------------------------
|
||||||
<kbd>TAB</kbd> | initiate the micro-state
|
<kbd>TAB</kbd> | initiate the micro-state
|
||||||
|
<kbd>1</kbd> | execute action 0
|
||||||
|
<kbd>2</kbd> | execute action 1
|
||||||
|
<kbd>3</kbd> | execute action 2
|
||||||
|
<kbd>4</kbd> | execute action 3
|
||||||
|
<kbd>5</kbd> | execute action 4
|
||||||
|
<kbd>6</kbd> | execute action 5
|
||||||
|
<kbd>7</kbd> | execute action 6
|
||||||
|
<kbd>8</kbd> | execute action 7
|
||||||
|
<kbd>9</kbd> | execute action 8
|
||||||
|
<kbd>0</kbd> | execute action 9
|
||||||
<kbd>a</kbd> | switch to actions page
|
<kbd>a</kbd> | switch to actions page
|
||||||
<kbd>g</kbd> | go to first candidate
|
<kbd>g</kbd> | go to first candidate
|
||||||
<kbd>G</kbd> | go to last candidate
|
<kbd>G</kbd> | go to last candidate
|
||||||
<kbd>h</kbd> | go to previous page
|
<kbd>h</kbd> | go to previous source
|
||||||
<kbd>j</kbd> | select next candidate
|
<kbd>j</kbd> | select next candidate
|
||||||
<kbd>k</kbd> | select previous candidate
|
<kbd>k</kbd> | select previous candidate
|
||||||
<kbd>l</kbd> | go to next page
|
<kbd>l</kbd> | go to next source
|
||||||
<kbd>r</kbd> | switch to actions page and leave the micro-state (useful combined with <kbd>TAB</kbd>)
|
<kbd>r</kbd> | switch to actions page and leave the micro-state (useful combined with <kbd>TAB</kbd>)
|
||||||
<kbd>t</kbd> | mark current candidate
|
<kbd>t</kbd> | mark current candidate
|
||||||
<kbd>T</kbd> | mark all candidates
|
<kbd>T</kbd> | mark all candidates
|
||||||
|
|
|
@ -1148,11 +1148,12 @@ which require an initialization must be listed explicitly in the list.")
|
||||||
(use-package helm
|
(use-package helm
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init
|
||||||
(setq helm-split-window-in-side-p nil
|
(progn
|
||||||
helm-bookmark-show-location t
|
(setq helm-split-window-in-side-p nil
|
||||||
helm-buffers-fuzzy-matching t
|
helm-bookmark-show-location t
|
||||||
helm-always-two-windows t)
|
helm-buffers-fuzzy-matching t
|
||||||
(evil-leader/set-key
|
helm-always-two-windows t)
|
||||||
|
(evil-leader/set-key
|
||||||
dotspacemacs-command-key 'helm-M-x
|
dotspacemacs-command-key 'helm-M-x
|
||||||
"bs" 'helm-mini
|
"bs" 'helm-mini
|
||||||
"sl" 'helm-semantic-or-imenu
|
"sl" 'helm-semantic-or-imenu
|
||||||
|
@ -1163,12 +1164,16 @@ which require an initialization must be listed explicitly in the list.")
|
||||||
"rm" 'helm-all-mark-rings
|
"rm" 'helm-all-mark-rings
|
||||||
"fh" 'helm-find-files
|
"fh" 'helm-find-files
|
||||||
"fr" 'helm-recentf
|
"fr" 'helm-recentf
|
||||||
"<f1>" 'helm-apropos
|
"<f1>" 'helm-apropos)
|
||||||
)
|
(defcustom spacemacs-helm-micro-state-color (face-attribute
|
||||||
|
'error :foreground)
|
||||||
|
"Background color of helm header when helm micro-state is activated."
|
||||||
|
:type 'color
|
||||||
|
:group 'spacemacs))
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(progn
|
(progn
|
||||||
(helm-mode +1)
|
(helm-mode +1)
|
||||||
|
|
||||||
;; alter helm-bookmark key bindings to be simpler
|
;; alter helm-bookmark key bindings to be simpler
|
||||||
(defun simpler-helm-bookmark-keybindings ()
|
(defun simpler-helm-bookmark-keybindings ()
|
||||||
(define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete)
|
(define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete)
|
||||||
|
@ -1208,8 +1213,9 @@ which require an initialization must be listed explicitly in the list.")
|
||||||
"Set a temporary overlay map to navigate in a helm buffer."
|
"Set a temporary overlay map to navigate in a helm buffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(set-face-attribute
|
(set-face-attribute
|
||||||
'helm-header nil :background (face-attribute
|
'helm-header nil
|
||||||
'error :foreground))
|
:background spacemacs-helm-micro-state-color)
|
||||||
|
|
||||||
;; deactivate TAB during the micro-state (any key can be used to exit
|
;; deactivate TAB during the micro-state (any key can be used to exit
|
||||||
;; the micro-state but this one seems to be a better choice so it
|
;; the micro-state but this one seems to be a better choice so it
|
||||||
;; deserves a special treatment)
|
;; deserves a special treatment)
|
||||||
|
@ -1217,16 +1223,21 @@ which require an initialization must be listed explicitly in the list.")
|
||||||
(define-key helm-map (kbd "<tab>") '(lambda () (interactive)))
|
(define-key helm-map (kbd "<tab>") '(lambda () (interactive)))
|
||||||
;; "r" switches to the action buffer and exit the micro-state
|
;; "r" switches to the action buffer and exit the micro-state
|
||||||
(define-key helm-map "r" 'helm-select-action)
|
(define-key helm-map "r" 'helm-select-action)
|
||||||
|
;; bind actions on numbers starting from 1 which executes action 0
|
||||||
|
(dotimes (n 10)
|
||||||
|
(define-key helm-map (number-to-string n)
|
||||||
|
`(lambda () (interactive) (helm-select-nth-action
|
||||||
|
,(% (+ n 9) 10)))))
|
||||||
(set-temporary-overlay-map
|
(set-temporary-overlay-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map "?" 'helm-help)
|
(define-key map "?" 'helm-help)
|
||||||
(define-key map "a" 'helm-select-action)
|
(define-key map "a" 'helm-select-action)
|
||||||
(define-key map "g" 'helm-beginning-of-buffer)
|
(define-key map "g" 'helm-beginning-of-buffer)
|
||||||
(define-key map "G" 'helm-end-of-buffer)
|
(define-key map "G" 'helm-end-of-buffer)
|
||||||
(define-key map "h" 'helm-previous-page)
|
(define-key map "h" 'helm-previous-source)
|
||||||
(define-key map "j" 'helm-next-line)
|
(define-key map "j" 'helm-next-line)
|
||||||
(define-key map "k" 'helm-previous-line)
|
(define-key map "k" 'helm-previous-line)
|
||||||
(define-key map "l" 'helm-next-page)
|
(define-key map "l" 'helm-next-source)
|
||||||
(define-key map "t" 'helm-toggle-visible-mark)
|
(define-key map "t" 'helm-toggle-visible-mark)
|
||||||
(define-key map "T" 'helm-toggle-all-marks)
|
(define-key map "T" 'helm-toggle-all-marks)
|
||||||
(define-key map "v" 'helm-execute-persistent-action)
|
(define-key map "v" 'helm-execute-persistent-action)
|
||||||
|
@ -1241,10 +1252,12 @@ which require an initialization must be listed explicitly in the list.")
|
||||||
(define-key helm-map (kbd "<tab>")
|
(define-key helm-map (kbd "<tab>")
|
||||||
'spacemacs/helm-navigation-micro-state)
|
'spacemacs/helm-navigation-micro-state)
|
||||||
(define-key helm-map "r" nil)
|
(define-key helm-map "r" nil)
|
||||||
|
(dotimes (n 10)
|
||||||
|
(define-key helm-map (number-to-string n) nil))
|
||||||
;; restore faces
|
;; restore faces
|
||||||
(set-face-attribute
|
(set-face-attribute
|
||||||
'helm-header nil :background (face-attribute
|
'helm-header nil
|
||||||
'header-line :background)))
|
:background (face-attribute 'header-line :background)))
|
||||||
(spacemacs/on-exit-helm-micro-state))
|
(spacemacs/on-exit-helm-micro-state))
|
||||||
|
|
||||||
(eval-after-load "helm-mode" ; required
|
(eval-after-load "helm-mode" ; required
|
||||||
|
|
Reference in a new issue