completion/ivy: remove redundant counsel-find-file actions
Many of these are already upstream, but some of them are on different keys (e.g. j instead of f for other-window). See https://github.com/abo-abo/swiper/blob/master/counsel.el#L1864-L1875
This commit is contained in:
parent
48a943b09f
commit
7095bdb7ce
1 changed files with 8 additions and 27 deletions
|
@ -245,37 +245,18 @@ 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)
|
||||||
|
|
||||||
;; Factories
|
|
||||||
(defun +ivy-action-reloading (cmd)
|
|
||||||
(lambda (x)
|
|
||||||
(funcall cmd x)
|
|
||||||
(ivy--reset-state ivy-last)))
|
|
||||||
|
|
||||||
(defun +ivy-action-given-file (cmd prompt)
|
|
||||||
(lambda (source)
|
|
||||||
(let* ((enable-recursive-minibuffers t)
|
|
||||||
(target (read-file-name (format "%s %s to:" prompt source))))
|
|
||||||
(funcall cmd source target 1))))
|
|
||||||
|
|
||||||
;; Configure `counsel-find-file'
|
;; Configure `counsel-find-file'
|
||||||
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
||||||
(ivy-add-actions
|
(ivy-add-actions
|
||||||
'counsel-find-file
|
'counsel-find-file
|
||||||
`(("b" counsel-find-file-cd-bookmark-action "cd bookmark")
|
'(("p" (lambda (path) (with-ivy-window (insert (file-relative-name path default-directory))))
|
||||||
("s" counsel-find-file-as-root "open as root")
|
"insert relative path")
|
||||||
("m" counsel-find-file-mkdir-action "mkdir")
|
("P" (lambda (path) (with-ivy-window (insert path)))
|
||||||
("c" ,(+ivy-action-given-file #'copy-file "Copy file") "copy file")
|
"insert absolute path")
|
||||||
("d" ,(+ivy-action-reloading #'+ivy-confirm-delete-file) "delete")
|
("l" (lambda (path) (with-ivy-window (insert (format "[[./%s]]" (file-relative-name path default-directory)))))
|
||||||
("r" (lambda (path) (rename-file path (read-string "New name: "))) "rename")
|
"insert relative org-link")
|
||||||
("R" ,(+ivy-action-reloading (+ivy-action-given-file #'rename-file "Move")) "move")
|
("L" (lambda (path) (with-ivy-window (insert (format "[[%s]]" path))))
|
||||||
("f" find-file-other-window "other window")
|
"Insert absolute org-link")))
|
||||||
("F" find-file-other-frame "other frame")
|
|
||||||
("p" (lambda (path) (with-ivy-window (insert (file-relative-name path default-directory)))) "insert relative path")
|
|
||||||
("P" (lambda (path) (with-ivy-window (insert path))) "insert absolute path")
|
|
||||||
("l" (lambda (path) "Insert org-link with relative path"
|
|
||||||
(with-ivy-window (insert (format "[[./%s]]" (file-relative-name path default-directory))))) "insert org-link (rel. path)")
|
|
||||||
("L" (lambda (path) "Insert org-link with absolute path"
|
|
||||||
(with-ivy-window (insert (format "[[%s]]" path)))) "insert org-link (abs. path)")))
|
|
||||||
|
|
||||||
(ivy-add-actions
|
(ivy-add-actions
|
||||||
'counsel-ag ; also applies to `counsel-rg'
|
'counsel-ag ; also applies to `counsel-rg'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue