Dispatch function spacemacs/jump-in-buffer to layers
Use imenu init and post-init functions to leverage the layer system and get better isolation of configuration.
This commit is contained in:
parent
0191a81ad2
commit
e4b15b16de
|
@ -179,6 +179,14 @@ Ensure that helm is required before calling FUNC."
|
||||||
(interactive)
|
(interactive)
|
||||||
(helm-exit-and-execute-action 'spacemacs//helm-find-files-edit))
|
(helm-exit-and-execute-action 'spacemacs//helm-find-files-edit))
|
||||||
|
|
||||||
|
(defun spacemacs/helm-jump-in-buffer ()
|
||||||
|
"Jump in buffer using `imenu' facilities and helm."
|
||||||
|
(interactive)
|
||||||
|
(call-interactively
|
||||||
|
(cond
|
||||||
|
((eq major-mode 'org-mode) 'helm-org-in-buffer-headings)
|
||||||
|
(t 'helm-semantic-or-imenu))))
|
||||||
|
|
||||||
|
|
||||||
;; Generalized next-error interface
|
;; Generalized next-error interface
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
helm-swoop
|
helm-swoop
|
||||||
helm-themes
|
helm-themes
|
||||||
(helm-spacemacs-help :location local)
|
(helm-spacemacs-help :location local)
|
||||||
|
imenu
|
||||||
popwin
|
popwin
|
||||||
projectile
|
projectile
|
||||||
))
|
))
|
||||||
|
@ -581,6 +582,9 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'."
|
||||||
(spacemacs/set-leader-keys
|
(spacemacs/set-leader-keys
|
||||||
"Ts" 'helm-themes)))
|
"Ts" 'helm-themes)))
|
||||||
|
|
||||||
|
(defun helm/post-init-imenu ()
|
||||||
|
(spacemacs/set-leader-keys "ji" 'spacemacs/helm-jump-in-buffer))
|
||||||
|
|
||||||
(defun helm/post-init-popwin ()
|
(defun helm/post-init-popwin ()
|
||||||
;; disable popwin-mode while Helm session is running
|
;; disable popwin-mode while Helm session is running
|
||||||
(add-hook 'helm-after-initialize-hook #'spacemacs//helm-prepare-display)
|
(add-hook 'helm-after-initialize-hook #'spacemacs//helm-prepare-display)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
evil
|
evil
|
||||||
flx
|
flx
|
||||||
helm-make
|
helm-make
|
||||||
|
imenu
|
||||||
ivy
|
ivy
|
||||||
ivy-hydra
|
ivy-hydra
|
||||||
(ivy-spacemacs-help :location local)
|
(ivy-spacemacs-help :location local)
|
||||||
|
@ -133,6 +134,9 @@
|
||||||
"cc" 'helm-make-projectile
|
"cc" 'helm-make-projectile
|
||||||
"cm" 'helm-make))))
|
"cm" 'helm-make))))
|
||||||
|
|
||||||
|
(defun ivy/post-init-imenu ()
|
||||||
|
(spacemacs/set-leader-keys "ji" 'counsel-imenu))
|
||||||
|
|
||||||
(defun ivy/init-ivy ()
|
(defun ivy/init-ivy ()
|
||||||
(use-package ivy
|
(use-package ivy
|
||||||
:config
|
:config
|
||||||
|
|
|
@ -61,19 +61,6 @@
|
||||||
(let ((message-log-max nil))
|
(let ((message-log-max nil))
|
||||||
(apply 'message msg args)))
|
(apply 'message msg args)))
|
||||||
|
|
||||||
(defun spacemacs/jump-in-buffer ()
|
|
||||||
(interactive)
|
|
||||||
(call-interactively
|
|
||||||
(cond
|
|
||||||
((and (configuration-layer/layer-usedp 'helm)
|
|
||||||
(eq major-mode 'org-mode))
|
|
||||||
'helm-org-in-buffer-headings)
|
|
||||||
((configuration-layer/layer-usedp 'helm)
|
|
||||||
'helm-semantic-or-imenu)
|
|
||||||
((configuration-layer/layer-usedp 'ivy)
|
|
||||||
'counsel-imenu)
|
|
||||||
(t 'imenu))))
|
|
||||||
|
|
||||||
(defun spacemacs/split-and-new-line ()
|
(defun spacemacs/split-and-new-line ()
|
||||||
"Split a quoted string or s-expression and insert a new line with
|
"Split a quoted string or s-expression and insert a new line with
|
||||||
auto-indent."
|
auto-indent."
|
||||||
|
|
|
@ -221,7 +221,6 @@
|
||||||
"j$" 'spacemacs/push-mark-and-goto-end-of-line
|
"j$" 'spacemacs/push-mark-and-goto-end-of-line
|
||||||
"jF" 'find-function-at-point
|
"jF" 'find-function-at-point
|
||||||
"jf" 'find-function
|
"jf" 'find-function
|
||||||
"ji" 'spacemacs/jump-in-buffer
|
|
||||||
"jv" 'find-variable
|
"jv" 'find-variable
|
||||||
"jV" 'find-variable-at-point)
|
"jV" 'find-variable-at-point)
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
(holy-mode :location local :step pre)
|
(holy-mode :location local :step pre)
|
||||||
(hybrid-mode :location local :step pre)
|
(hybrid-mode :location local :step pre)
|
||||||
(image-mode :location built-in)
|
(image-mode :location built-in)
|
||||||
|
(imenu :location built-in)
|
||||||
(linum :location built-in)
|
(linum :location built-in)
|
||||||
(occur-mode :location built-in)
|
(occur-mode :location built-in)
|
||||||
(package-menu :location built-in)
|
(package-menu :location built-in)
|
||||||
|
@ -225,6 +226,11 @@
|
||||||
:config (evilified-state-evilify-map image-mode-map
|
:config (evilified-state-evilify-map image-mode-map
|
||||||
:mode image-mode)))
|
:mode image-mode)))
|
||||||
|
|
||||||
|
(defun spacemacs-base/init-imenu ()
|
||||||
|
(use-package imenu
|
||||||
|
:defer t
|
||||||
|
:init (spacemacs/set-leader-keys "ji" 'imenu)))
|
||||||
|
|
||||||
(defun spacemacs-base/init-linum ()
|
(defun spacemacs-base/init-linum ()
|
||||||
(when dotspacemacs-line-numbers
|
(when dotspacemacs-line-numbers
|
||||||
(add-hook 'prog-mode-hook 'linum-mode)
|
(add-hook 'prog-mode-hook 'linum-mode)
|
||||||
|
|
Loading…
Reference in a new issue