ivy: improve jumping in buffer

This commit is contained in:
Kalle Lindqvist 2018-06-06 21:37:58 +02:00 committed by bmag
parent e109777f8b
commit dfd309a77b
2 changed files with 12 additions and 2 deletions

View File

@ -350,6 +350,15 @@ To prevent this error we just wrap `describe-mode' to defeat the
((headline inlinetask)
(save-excursion (goto-char (org-element-property :begin context))
(call-interactively 'counsel-org-tag)) t)))))
(defun spacemacs/counsel-jump-in-buffer ()
"Jump in buffer with `counsel-imenu' or `counsel-org-goto' if in in org-mode"
(interactive)
(call-interactively
(cond
((eq major-mode 'org-mode) 'counsel-org-goto)
(t 'counsel-imenu))))
;; Ivy

View File

@ -18,6 +18,7 @@
evil
flx
helm-make
imenu
ivy
ivy-hydra
(ivy-rich :toggle ivy-enable-advanced-buffer-information)
@ -74,7 +75,7 @@
"ry" 'counsel-yank-pop
"rm" 'counsel-mark-ring
;; jumping
"sj" 'counsel-imenu
"sj" 'spacemacs/counsel-jump-in-buffer
;; themes
"Ts" 'counsel-load-theme
;; search
@ -174,7 +175,7 @@
"cm" 'helm-make))))
(defun ivy/post-init-imenu ()
(spacemacs/set-leader-keys "ji" 'counsel-imenu))
(spacemacs/set-leader-keys "ji" 'spacemacs/counsel-jump-in-buffer))
(defun ivy/init-ivy ()
(use-package ivy