From 992fcc1849ea155c488a938c815681b5532c79a8 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Wed, 18 Oct 2017 22:55:06 +0200 Subject: [PATCH] emacs - Disable opening directories with TAB in find-file --- emacs/.emacs.d/init.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 983a21c..d8823fc 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -407,6 +407,11 @@ "WIP: Tells evil-jump to save position before jumping via imenu (or counsel-imenu)" (evil--jumps-push)) +;; Prevents opening directories in dired when pressing TAB +(defun my/ivy-dont-tab-dir (orig &rest args) + (when (> (length ivy-text) 0) + (apply orig args))) + (use-package ivy :ensure t :demand t @@ -417,7 +422,8 @@ (setq ivy-count-format "(%d/%d) ") (advice-add 'imenu :before 'my/save-imenu-jump) (define-key ivy-minibuffer-map (kbd "") 'ivy-immediate-done) - (set-face-attribute 'ivy-current-match nil :foreground "gold")) + (set-face-attribute 'ivy-current-match nil :foreground "gold") + (advice-add 'ivy--directory-done :around #'my/ivy-dont-tab-dir)) (use-package counsel :ensure t