Fix extra ivy actions for counsel-{rg,find-file}

This commit is contained in:
Henrik Lissner 2019-12-31 00:02:00 -05:00
parent a947f64ff2
commit fb261a9c65
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -211,7 +211,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; Record in jumplist when opening files via counsel-{ag,rg,pt,git-grep} ;; Record in jumplist when opening files via counsel-{ag,rg,pt,git-grep}
(add-hook 'counsel-grep-post-action-hook #'better-jumper-set-jump) (add-hook 'counsel-grep-post-action-hook #'better-jumper-set-jump)
(ivy-add-actions (ivy-add-actions
'counsel-ag ; also applies to `counsel-rg' 'counsel-rg ; also applies to `counsel-rg'
'(("O" +ivy-git-grep-other-window-action "open in other window"))) '(("O" +ivy-git-grep-other-window-action "open in other window")))
;; Make `counsel-compile' projectile-aware (if you prefer it over ;; Make `counsel-compile' projectile-aware (if you prefer it over
@ -232,16 +232,16 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; `counsel-find-file' ;; `counsel-find-file'
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)") (setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
(ivy-add-actions (dolist (fn '(counsel-rg counsel-find-file))
'counsel-find-file (ivy-add-actions
'(("p" (lambda (path) (with-ivy-window (insert (file-relative-name path default-directory)))) fn '(("p" (lambda (path) (with-ivy-window (insert (file-relative-name path default-directory))))
"insert relative path") "insert relative path")
("P" (lambda (path) (with-ivy-window (insert path))) ("P" (lambda (path) (with-ivy-window (insert path)))
"insert absolute path") "insert absolute path")
("l" (lambda (path) (with-ivy-window (insert (format "[[./%s]]" (file-relative-name path default-directory))))) ("l" (lambda (path) (with-ivy-window (insert (format "[[./%s]]" (file-relative-name path default-directory)))))
"insert relative org-link") "insert relative org-link")
("L" (lambda (path) (with-ivy-window (insert (format "[[%s]]" path)))) ("L" (lambda (path) (with-ivy-window (insert (format "[[%s]]" path))))
"Insert absolute org-link"))) "Insert absolute org-link"))))
;; `counsel-search': use normal page for displaying results, so that we see ;; `counsel-search': use normal page for displaying results, so that we see
;; custom ddg themes (if one is set). ;; custom ddg themes (if one is set).