Add some experimental changes to counsel-find-file
This commit is contained in:
parent
f12fcb7851
commit
5c06431d23
@ -236,12 +236,43 @@
|
||||
("C-r" . swiper)
|
||||
("C-c C-r" . ivy-resume)
|
||||
:map swiper-map ("C-r" . ivy-previous-line-or-history)
|
||||
:map ivy-minibuffer-map ("C-'" . ivy-avy))
|
||||
:map ivy-minibuffer-map ("C-'" . ivy-avy)
|
||||
:map counsel-find-file-map ("C-M-i" . counsel-find-file-edit-path))
|
||||
:init
|
||||
(bind-key "C-S-s" 'isearch-forward)
|
||||
(bind-key "C-S-r" 'isearch-backward)
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
(ivy-mode 1)
|
||||
(defun ivy-backward-delete-char ()
|
||||
"Forward to `backward-delete-char'.
|
||||
Do less dumb things with directories
|
||||
On error (read-only), call `ivy-on-del-error-function'."
|
||||
(interactive)
|
||||
(if (and ivy--directory (= (minibuffer-prompt-end) (point)))
|
||||
(progn
|
||||
(let ((old-dir (file-name-nondirectory
|
||||
(directory-file-name
|
||||
(expand-file-name
|
||||
ivy--directory)))))
|
||||
(ivy--cd (file-name-directory
|
||||
(directory-file-name
|
||||
(expand-file-name
|
||||
ivy--directory))))
|
||||
(insert old-dir))
|
||||
(ivy--exhibit))
|
||||
(condition-case nil
|
||||
(backward-delete-char 1)
|
||||
(error
|
||||
(when ivy-on-del-error-function
|
||||
(funcall ivy-on-del-error-function))))))
|
||||
|
||||
(defun counsel-find-file-edit-path ()
|
||||
"Edit the current path in ivy find-file"
|
||||
(interactive)
|
||||
(let ((old-path
|
||||
(substring (concat (expand-file-name ivy--directory) ivy-text) 1 -1)))
|
||||
(ivy--cd "/")
|
||||
(insert old-path))))
|
||||
|
||||
(use-package ivy-hydra :ensure)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user