Forked from rejeep/rejeep-projectile-completion-fn.el
Created
September 17, 2013 21:37
-
-
Save glucas/6601000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun rejeep-projectile-completion-fn (prompt choises) | |
"Projectile completion function that only shows file name. | |
If two files have same name, new completion appears to select between | |
them. These include the path relative to the project root." | |
(interactive) | |
(let* ((stripped-choises | |
(-uniq (--map (file-name-nondirectory it) choises))) | |
(choise | |
(ido-completing-read prompt stripped-choises)) | |
(matching-files | |
(-filter | |
(lambda (file) | |
(equal (file-name-nondirectory file) choise)) | |
choises))) | |
(if (> (length matching-files) 1) | |
(ido-completing-read prompt matching-files) | |
(car matching-files)))) | |
(setq projectile-completion-system 'rejeep-projectile-completion-fn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment