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) ((headline inlinetask)
(save-excursion (goto-char (org-element-property :begin context)) (save-excursion (goto-char (org-element-property :begin context))
(call-interactively 'counsel-org-tag)) t))))) (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 ;; Ivy

View file

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